workingOn() public method

Tell Redis which job we're currently working on.
public workingOn ( Resque_Job $job )
$job Resque_Job Resque_Job instance containing the job we're working on.
Esempio n. 1
0
 public function testRecreatedJobWithTrackingStillTracksStatus()
 {
     $originalToken = Resque::enqueue('jobs', 'Test_Job', null, true);
     $job = $this->worker->reserve();
     // Mark this job as being worked on to ensure that the new status is still
     // waiting.
     $this->worker->workingOn($job);
     // Now recreate it
     $newToken = $job->recreate();
     // Make sure we've got a new job returned
     $this->assertNotEquals($originalToken, $newToken);
     // Now check the status of the new job
     $newJob = Resque_Job::reserve('jobs');
     $this->assertEquals(Resque_Job_Status::STATUS_WAITING, $newJob->getStatus());
 }
Esempio n. 2
0
 public function testWorkerFailsUncompletedJobsOnExit()
 {
     $worker = new Resque_Worker('jobs');
     $worker->setLogger(new Resque_Log());
     $worker->registerWorker();
     $payload = array('class' => 'Test_Job');
     $job = new Resque_Job('jobs', $payload);
     $worker->workingOn($job);
     $worker->unregisterWorker();
     $this->assertEquals(1, Resque_Stat::get('failed'));
 }