mirror of
https://github.com/idanoo/php-resque
synced 2025-07-01 05:32:20 +00:00
Working blocking list pop :)
This commit is contained in:
parent
b8f98eecd2
commit
86ae77811d
14 changed files with 604 additions and 73 deletions
|
@ -91,21 +91,20 @@ class Resque_Job
|
|||
}
|
||||
|
||||
/**
|
||||
* Find the next available job from the specified queue and return an
|
||||
* instance of Resque_Job for it.
|
||||
* Find the next available job from the specified queues using blocking list pop
|
||||
* and return an instance of Resque_Job for it.
|
||||
*
|
||||
* @param string $queue The name of the queue to check for a job in.
|
||||
* @param array $queues
|
||||
* @param int $timeout
|
||||
* @return null|object Null when there aren't any waiting jobs, instance of Resque_Job when a job was found.
|
||||
*/
|
||||
public static function reserveBlocking($queues, $interval = null)
|
||||
public static function reserveBlocking(array $queues, $timeout = null)
|
||||
{
|
||||
$payload = Resque::blpop($queues, $interval);
|
||||
$payload = Resque::blpop($queues, $timeout);
|
||||
if(!is_array($payload)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var_dump($payload);
|
||||
|
||||
return new Resque_Job($payload->queue, $payload);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue