Merge pull request #49 from ckbigcommerce/master

updated method comments
This commit is contained in:
Chris Boulton 2012-03-17 00:53:06 -07:00
commit ff3fc97958
4 changed files with 23 additions and 11 deletions

View File

@ -42,6 +42,7 @@ class Resque
*
* @param mixed $server Host/port combination separated by a colon, or
* a nested array of servers with host/port pairs.
* @param int $database
*/
public static function setBackend($server, $database = 0)
{
@ -127,6 +128,8 @@ class Resque
/**
* 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.
*/
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 $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 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)
{

View File

@ -20,8 +20,8 @@ class Resque_Failure
* Create a new failed job on the backend.
*
* @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 object $worker Instance of Resque_Worker that was running this job when it failed.
* @param \Exception $exception The exception generated when the job failed to run.
* @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.
*/
public static function create($payload, Exception $exception, Resque_Worker $worker, $queue)

View File

@ -52,6 +52,8 @@ class Resque_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 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)
{
@ -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->args = $this->getArguments();
return $this->instance;
@ -164,6 +166,7 @@ class Resque_Job
* Actually execute a job by calling the perform method on the class
* 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.
*/
public function perform()
@ -194,6 +197,8 @@ class Resque_Job
/**
* Mark the current job as having failed.
*
* @param $exception
*/
public function fail($exception)
{
@ -216,6 +221,7 @@ class Resque_Job
/**
* Re-queue the current job.
* @return string
*/
public function recreate()
{

View File

@ -61,6 +61,7 @@ class Resque_Worker
/**
* Return all workers known to Resque as instantiated instances.
* @return array
*/
public static function all()
{
@ -192,12 +193,12 @@ class Resque_Worker
$this->child = $this->fork();
// 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');
$this->updateProcLine($status);
$this->log($status, self::LOG_VERBOSE);
$this->perform($job);
if($this->child === 0) {
if ($this->child === 0) {
exit(0);
}
}
@ -228,7 +229,7 @@ class Resque_Worker
/**
* 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)
{