sleep
laravel/framework
Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Delay execution
sleep
(
int $seconds
):
int
if (
$seconds
<
1
) {
usleep
(
$seconds
*
1000000
);
} else {
sleep
(
$seconds
);
}
}
src/Illuminate/Queue/Worker.php
$firstLock
=
Cache
::
lock
(
'foo'
,
1
);
$this
->
assertTrue
(
$firstLock
->
get
());
sleep
(
2
);
$secondLock
=
Cache
::
lock
(
'foo'
,
10
);
$this
->
assertTrue
(
$secondLock
->
get
());
tests/Integration/Cache/FileCacheLockTest.php
$firstLock
=
Cache
::
store
(
'memcached'
)->
lock
(
'bar'
,
1
);
$this
->
assertTrue
(
$firstLock
->
acquire
());
sleep
(
2
);
$secondLock
=
Cache
::
store
(
'memcached'
)->
lock
(
'bar'
,
10
);
$this
->
assertTrue
(
$secondLock
->
acquire
());
tests/Integration/Cache/MemcachedCacheLockTestCase.php
$firstLock
=
Cache
::
store
(
'redis'
)->
lock
(
'foo'
,
1
);
$this
->
assertTrue
(
$firstLock
->
get
());
sleep
(
2
);
$secondLock
=
Cache
::
store
(
'redis'
)->
lock
(
'foo'
,
10
);
$this
->
assertTrue
(
$secondLock
->
get
());
tests/Integration/Cache/RedisCacheLockTest.php
public function
handle
()
{
sleep
(
1
);
static::
$ran
=
true
;
}
tests/Integration/Queue/WorkCommandTest.php
} elseif (
$pid
==
0
) {
$this
->
setUpRedis
();
$this
->
setQueue
(
'phpredis'
);
sleep
(
1
);
$this
->
queue
->
push
(new
RedisQueueIntegrationTestJob
(
12
));
exit;
} else {
tests/Queue/RedisQueueIntegrationTest.php
$this
->
assertEquals
([
1
,
2
],
$store
);
sleep
(
2
);
(new
DurationLimiter
(
$this
->
redis
(),
'key'
,
2
,
2
))->
block
(
0
, function () use (&
$store
) {
$store
[] =
3
;
tests/Redis/DurationLimiterTest.php