mirror of
https://github.com/idanoo/php-resque.git
synced 2024-11-22 16:25:14 +00:00
Merge pull request #49 from ckbigcommerce/master
updated method comments
This commit is contained in:
commit
ff3fc97958
@ -41,7 +41,8 @@ class Resque
|
|||||||
* the redis server that Resque will talk to.
|
* the redis server that Resque will talk to.
|
||||||
*
|
*
|
||||||
* @param mixed $server Host/port combination separated by a colon, or
|
* @param mixed $server Host/port combination separated by a colon, or
|
||||||
* a nested array of servers with host/port pairs.
|
* a nested array of servers with host/port pairs.
|
||||||
|
* @param int $database
|
||||||
*/
|
*/
|
||||||
public static function setBackend($server, $database = 0)
|
public static function setBackend($server, $database = 0)
|
||||||
{
|
{
|
||||||
@ -127,6 +128,8 @@ class Resque
|
|||||||
/**
|
/**
|
||||||
* Return the size (number of pending jobs) of the specified queue.
|
* Return the size (number of pending jobs) of the specified queue.
|
||||||
*
|
*
|
||||||
|
* @param $queue name of the queue to be checked for pending jobs
|
||||||
|
*
|
||||||
* @return int The size of the queue.
|
* @return int The size of the queue.
|
||||||
*/
|
*/
|
||||||
public static function size($queue)
|
public static function size($queue)
|
||||||
@ -140,7 +143,9 @@ class Resque
|
|||||||
* @param string $queue The name of the queue to place the job in.
|
* @param string $queue The name of the queue to place the job in.
|
||||||
* @param string $class The name of the class that contains the code to execute the job.
|
* @param string $class The name of the class that contains the code to execute the job.
|
||||||
* @param array $args Any optional arguments that should be passed when the job is executed.
|
* @param array $args Any optional arguments that should be passed when the job is executed.
|
||||||
* @param boolean $monitor Set to true to be able to monitor the status of a job.
|
* @param boolean $trackStatus Set to true to be able to monitor the status of a job.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function enqueue($queue, $class, $args = null, $trackStatus = false)
|
public static function enqueue($queue, $class, $args = null, $trackStatus = false)
|
||||||
{
|
{
|
||||||
|
@ -19,10 +19,10 @@ class Resque_Failure
|
|||||||
/**
|
/**
|
||||||
* Create a new failed job on the backend.
|
* Create a new failed job on the backend.
|
||||||
*
|
*
|
||||||
* @param object $payload The contents of the job that has just failed.
|
* @param object $payload The contents of the job that has just failed.
|
||||||
* @param object $exception The exception generated when the job failed to run.
|
* @param \Exception $exception The exception generated when the job failed to run.
|
||||||
* @param object $worker Instance of Resque_Worker that was running this job when it failed.
|
* @param \Resque_Worker $worker Instance of Resque_Worker that was running this job when it failed.
|
||||||
* @param string $queue The name of the queue that this job was fetched from.
|
* @param string $queue The name of the queue that this job was fetched from.
|
||||||
*/
|
*/
|
||||||
public static function create($payload, Exception $exception, Resque_Worker $worker, $queue)
|
public static function create($payload, Exception $exception, Resque_Worker $worker, $queue)
|
||||||
{
|
{
|
||||||
|
@ -52,6 +52,8 @@ class Resque_Job
|
|||||||
* @param string $class The name of the class that contains the code to execute the job.
|
* @param string $class The name of the class that contains the code to execute the job.
|
||||||
* @param array $args Any optional arguments that should be passed when the job is executed.
|
* @param array $args Any optional arguments that should be passed when the job is executed.
|
||||||
* @param boolean $monitor Set to true to be able to monitor the status of a job.
|
* @param boolean $monitor Set to true to be able to monitor the status of a job.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function create($queue, $class, $args = null, $monitor = false)
|
public static function create($queue, $class, $args = null, $monitor = false)
|
||||||
{
|
{
|
||||||
@ -154,7 +156,7 @@ class Resque_Job
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->instance = new $this->payload['class'];
|
$this->instance = new $this->payload['class']();
|
||||||
$this->instance->job = $this;
|
$this->instance->job = $this;
|
||||||
$this->instance->args = $this->getArguments();
|
$this->instance->args = $this->getArguments();
|
||||||
return $this->instance;
|
return $this->instance;
|
||||||
@ -164,6 +166,7 @@ class Resque_Job
|
|||||||
* Actually execute a job by calling the perform method on the class
|
* Actually execute a job by calling the perform method on the class
|
||||||
* associated with the job with the supplied arguments.
|
* associated with the job with the supplied arguments.
|
||||||
*
|
*
|
||||||
|
* @return bool
|
||||||
* @throws Resque_Exception When the job's class could not be found or it does not contain a perform method.
|
* @throws Resque_Exception When the job's class could not be found or it does not contain a perform method.
|
||||||
*/
|
*/
|
||||||
public function perform()
|
public function perform()
|
||||||
@ -194,6 +197,8 @@ class Resque_Job
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark the current job as having failed.
|
* Mark the current job as having failed.
|
||||||
|
*
|
||||||
|
* @param $exception
|
||||||
*/
|
*/
|
||||||
public function fail($exception)
|
public function fail($exception)
|
||||||
{
|
{
|
||||||
@ -216,6 +221,7 @@ class Resque_Job
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Re-queue the current job.
|
* Re-queue the current job.
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function recreate()
|
public function recreate()
|
||||||
{
|
{
|
||||||
|
@ -61,6 +61,7 @@ class Resque_Worker
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return all workers known to Resque as instantiated instances.
|
* Return all workers known to Resque as instantiated instances.
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function all()
|
public static function all()
|
||||||
{
|
{
|
||||||
@ -192,12 +193,12 @@ class Resque_Worker
|
|||||||
$this->child = $this->fork();
|
$this->child = $this->fork();
|
||||||
|
|
||||||
// Forked and we're the child. Run the job.
|
// Forked and we're the child. Run the job.
|
||||||
if($this->child === 0 || $this->child === false) {
|
if ($this->child === 0 || $this->child === false) {
|
||||||
$status = 'Processing ' . $job->queue . ' since ' . strftime('%F %T');
|
$status = 'Processing ' . $job->queue . ' since ' . strftime('%F %T');
|
||||||
$this->updateProcLine($status);
|
$this->updateProcLine($status);
|
||||||
$this->log($status, self::LOG_VERBOSE);
|
$this->log($status, self::LOG_VERBOSE);
|
||||||
$this->perform($job);
|
$this->perform($job);
|
||||||
if($this->child === 0) {
|
if ($this->child === 0) {
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -228,7 +229,7 @@ class Resque_Worker
|
|||||||
/**
|
/**
|
||||||
* Process a single job.
|
* Process a single job.
|
||||||
*
|
*
|
||||||
* @param object|null $job The job to be processed.
|
* @param Resque_Job $job The job to be processed.
|
||||||
*/
|
*/
|
||||||
public function perform(Resque_Job $job)
|
public function perform(Resque_Job $job)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user