Beispiel #1
0
 /**
  * Mark the current job as having failed.
  *
  * @param $exception
  */
 public function fail($exception)
 {
     Resque_Event::trigger('onFailure', array('exception' => $exception, 'job' => $this));
     $this->updateStatus(Resque_Job_Status::STATUS_FAILED);
     Resque_Failure::create($this->payload, $exception, $this->worker, $this->queue);
     Resque_Stat::incr('failed');
     Resque_Stat::incr('failed:' . $this->worker);
 }
Beispiel #2
0
 /**
  * Set the backend to use for raised job failures. The supplied backend
  * should be the name of a class to be instantiated when a job fails.
  * It is your responsibility to have the backend class loaded (or autoloaded)
  *
  * @param string $backend The class name of the backend to pipe failures to.
  */
 public static function setBackend($backend)
 {
     self::$backend = $backend;
 }
Beispiel #3
0
 /**
  * Perform the job
  *
  * @return void
  */
 public function perform()
 {
     \Resque_Failure::setBackend('\\Zym\\Bundle\\ResqueBundle\\Failure\\Redis');
     $this->run($this->args);
 }
 /**
  * Mark the current job as having failed.
  *
  * @param $exception
  */
 public function fail($exception)
 {
     Resque_Event::trigger('onFailure', array('exception' => $exception, 'job' => $this));
     // job的状态更新成failed
     $this->updateStatus(Resque_Job_Status::STATUS_FAILED);
     require_once dirname(__FILE__) . '/Failure.php';
     // 记录信息到failed队列中
     Resque_Failure::create($this->payload, $exception, $this->worker, $this->queue);
     // 失败状态的个数+1
     Resque_Stat::incr('failed');
     Resque_Stat::incr('failed:' . $this->worker);
 }
Beispiel #5
0
	/**
	 * Mark the current job as having failed.
	 */
	public function fail($exception)
	{
		$this->updateStatus(Resque_Job_Status::STATUS_FAILED);
		require_once dirname(__FILE__).'/Failure.php';
		Resque_Failure::create(
			$this->payload,
			$exception,
			$this->worker,
			$this->queue
		);
	}