mirror of
https://github.com/idanoo/php-resque
synced 2025-07-01 05:32:20 +00:00
WIP
This commit is contained in:
parent
ff0d2bc655
commit
132531e1a2
7 changed files with 150 additions and 102 deletions
|
@ -71,22 +71,41 @@ class Resque_Job
|
|||
return $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the next available job from the specified queue and return an
|
||||
* instance of Resque_Job for it.
|
||||
*
|
||||
* @param string $queue The name of the queue to check for a job in.
|
||||
* @return null|object Null when there aren't any waiting jobs, instance of Resque_Job when a job was found.
|
||||
*/
|
||||
public static function reserve($queue, $interval = null)
|
||||
{
|
||||
$payload = Resque::pop($queue, $interval);
|
||||
if(!is_array($payload)) {
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Find the next available job from the specified queue and return an
|
||||
* instance of Resque_Job for it.
|
||||
*
|
||||
* @param string $queue The name of the queue to check for a job in.
|
||||
* @return null|object Null when there aren't any waiting jobs, instance of Resque_Job when a job was found.
|
||||
*/
|
||||
public static function reserve($queue)
|
||||
{
|
||||
$payload = Resque::pop($queue);
|
||||
if(!is_array($payload)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return new Resque_Job($queue, $payload);
|
||||
}
|
||||
return new Resque_Job($queue, $payload);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the next available job from the specified queue and return an
|
||||
* instance of Resque_Job for it.
|
||||
*
|
||||
* @param string $queue The name of the queue to check for a job in.
|
||||
* @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)
|
||||
{
|
||||
$payload = Resque::blpop($queues, $interval);
|
||||
if(!is_array($payload)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var_dump($payload);
|
||||
|
||||
return new Resque_Job($payload->queue, $payload);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the status of the current job.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue