/** * Find the next available job from the specified queues using blocking list pop * and return an instance of Resque_Job for it. * * @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(array $queues, $timeout = null) { $item = Resque::blpop($queues, $timeout); if (!is_array($item)) { return false; } return new Resque_Job($item['queue'], $item['payload']); }
public static function reserveBlocking(array $queues, $timeout = null) { $item = Resque::blpop($queues, $timeout); if (!is_array($item)) { return false; } if (isset($item['payload']['closure'])) { return new Resque_Job_Closure($item['queue'], $item['payload']); } else { return new Resque_Job_Class($item['queue'], $item['payload']); } }