Example #1
0
 /**
  * Re-queue the current job.
  *
  * @param int $enqueuedAt
  *            Enqueue timestamp
  * @return string the job id
  */
 public function recreate($enqueuedAt = 0, $isLast = false)
 {
     if ($isLast) {
         $queue = Constant::$LAST_RETRY_QUEUE;
     } else {
         $queue = $this->queue;
     }
     $status = new Resque_Job_Status($this->payload['id']);
     $this->payload['args'][0]['id'] = $this->payload['id'];
     if (Resque::redis()->exists('worker:delayed:started')) {
         $enqueuedAt += (int) time();
         $jobItem = array_merge($this->payload, array('queue' => $queue));
         unset($jobItem['id']);
         call_user_func_array('ResqueScheduler::delayedPush', array($enqueuedAt, $jobItem));
     } else {
         self::create($queue, $this->payload['class'], $this->payload['args'], $status->isTracking());
     }
     Resque_Event::trigger('afterRetry', array('payload' => $this->payload, 'enqueuedAt' => $enqueuedAt));
     return $this->payload['id'];
 }
Example #2
0
 /**
  * Check job status
  *
  * @param string $token
  *            Job token ID
  *
  * @return string Job Status
  */
 public function status($token)
 {
     $status = new Resque_Job_Status($token);
     return $status->get();
 }