-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUGFIX: When working on job, catch Throwable #59
BUGFIX: When working on job, catch Throwable #59
Conversation
When working on a job, any `\Exception` is caught and the job in the queue is released (retry or failure). In case of a `\Throwable` _not_ being an `\Exception`, this does not happen and the job is never "un- reserved". This change catches `\Throwable` instead to fix this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
$maximumNumberOfReleases = isset($queueSettings['maximumNumberOfReleases']) ? | ||
(int)$queueSettings['maximumNumberOfReleases'] : | ||
self::DEFAULT_MAXIMUM_NUMBER_RELEASES; | ||
if ($message->getNumberOfReleases() < $maximumNumberOfReleases) { | ||
$releaseOptions = isset($queueSettings['releaseOptions']) ? $queueSettings['releaseOptions'] : []; | ||
$queue->release($message->getIdentifier(), $releaseOptions); | ||
$this->emitMessageReleased($queue, $message, $releaseOptions, $exception); | ||
$logMessage = $this->throwableStorage->logThrowable($exception); | ||
$this->emitMessageReleased($queue, $message, $releaseOptions, $throwable); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doh, this part now fails if $throwable
is an \Error
– and changing the signal signature would be a breaking change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😬
When working on a job, any
\Exception
is caught and the job in thequeue is released (retry or failure). In case of a
\Throwable
notbeing an
\Exception
, this does not happen and the job is never "un-reserved".
This change catches
\Throwable
instead to fix this.