diff --git a/src/Queue/Exception/FatalException.php b/src/Queue/Exception/FatalException.php new file mode 100644 index 0000000..9938b70 --- /dev/null +++ b/src/Queue/Exception/FatalException.php @@ -0,0 +1,13 @@ + + */ +class FatalException extends Exception +{} diff --git a/src/Queue/Helper.php b/src/Queue/Helper.php index 893398e..a069749 100644 --- a/src/Queue/Helper.php +++ b/src/Queue/Helper.php @@ -4,11 +4,12 @@ use Carbon\Carbon; use Exception; -use Pheanstalk\Pheanstalk; use Pheanstalk\Contract\PheanstalkInterface; +use Pheanstalk\Pheanstalk; use Psr\Log\LoggerInterface; use Ronanchilvers\Foundation\Psr\Traits\LoggerAwareTrait; use Ronanchilvers\Foundation\Queue\Exception\FailedJobException; +use Ronanchilvers\Foundation\Queue\Exception\FatalException; use Ronanchilvers\Foundation\Queue\Exception\InvalidPayloadException; use Ronanchilvers\Foundation\Queue\Handler\ClassJobHandler; use Ronanchilvers\Foundation\Queue\Job\DispatchableInterface; @@ -116,10 +117,10 @@ public function watch($queue, $timeout = 5, $maxIterations = null, OutputInterfa $output->writeln('Deleting job : ' . $queueJob->getId()); $this->connection->delete($queueJob); - // } catch (FatalException $ex) { - // $this->logger->error('Fatal : ' . $ex->getMessage(), ['exception' => $ex]); - // $output->writeln('Burying job after fatal exception : ' . $queueJob->getId()); - // $this->connection->bury($queueJob); + } catch (FatalException $ex) { + $this->logger->error('Fatal : ' . $ex->getMessage(), ['exception' => $ex]); + $output->writeln('Burying job after fatal exception : ' . $queueJob->getId()); + $this->connection->bury($queueJob); } catch (Exception $ex) { $this->logger->error($ex->getMessage(), ['exception' => $ex]); $output->writeln('Releasing failed job : ' . $queueJob->getId());