blpop() public static method

Pop an item off the end of the specified queues, using blocking list pop, decode it and return it.
public static blpop ( array $queues, integer $timeout ) : null | array
$queues array
$timeout integer
return null | array Decoded item from the queue.
Ejemplo n.º 1
0
 /**
  * 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']);
 }
Ejemplo n.º 2
0
 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']);
     }
 }