/** * @param Job $job */ public function handleFailedJob(Job $job) { $stats = $job->stats(); $normalizedTries = ($stats['reserves'] - 1) % $this->config->getMaxTries() + 1; if ($normalizedTries >= $this->config->getMaxTries()) { $job->bury($stats['pri']); $this->logger->warning('Job exceeded maximum tries, burying', ['job' => $job]); } else { $delay = $this->config->getDefaultFailureDelay() * $normalizedTries; $job->release($stats['pri'], $delay); $this->logger->notice('Releasing job with delay', ['job' => $job, 'delay' => $delay]); } }
public function testBury_withParams_delegatesToBeanieJob() { $testPriority = 666; $this->beanieJobMock->expects($this->once())->method('bury')->with($testPriority); $this->job->bury($testPriority); }