public function testDeleteJobFromQueue() { $pheanstalk = $this->createPheanstalkMock(); $pheanstalk->method('delete')->willReturn($pheanstalk); $job = new Job($this->job_name, $this->job_data); $job->setId(123456); $queue = new BeanstalkQueue($pheanstalk, 'test'); $queue->delete($job); }
/** * @param Job $job */ protected function executeJob($job) { $this->log('Executing job ' . $job->getId()); if ($this->runner->runJob($job)) { $this->queue->delete($job); } else { $this->log("Job failed"); if ($this->queue->countReserves($job) < 3) { $this->log("Putting back in queue"); $this->queue->release($job); } else { $this->log("Putting job on hold"); $this->queue->bury($job); } } }
public function testCreateFromPayload() { $job = new Job($this->job_name, $this->job_data); $job2 = Job::createFromPayload($job->getPayload()); $this->assertEquals($job, $job2); }
public function countReserves(Job $job) { $stats = $this->pheanstalk->statsJob($job->getId()); return $stats->reserves; }