-
-
Notifications
You must be signed in to change notification settings - Fork 292
Prevent multiple execution of aborted jobs #528
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
Changes from 6 commits
95c21de
83fac4c
2c5d0ff
18e342f
14bfe70
1cbc278
99d9f89
77feac5
d76bdc6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -225,6 +225,16 @@ public function getWorkerPid() | |
protected function handleMessage($id, $message, $ttr, $attempt) | ||
{ | ||
list($job, $error) = $this->unserializeMessage($message); | ||
|
||
// Handle aborted jobs without thrown error | ||
luke- marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if ($attempt > 1) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that all this can be combined into one condition There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @s1lver Shall I summarize that? I'd be happy to. I personally prefer the breakdown for quick readability. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about this solution? Will return true if any of the conditions evaluate to true return
($job instanceof RetryableJobInterface && !$job->canRetry($attempt - 1, $error))
|| (!($job instanceof RetryableJobInterface) && $attempt > $this->attempts) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
if ($job instanceof RetryableJobInterface && !$job->canRetry($attempt - 1, $error)) { | ||
return true; | ||
} elseif (!($job instanceof RetryableJobInterface) && $attempt > $this->attempts) { | ||
return true; | ||
} | ||
} | ||
|
||
$event = new ExecEvent([ | ||
'id' => $id, | ||
'job' => $job, | ||
|
Uh oh!
There was an error while loading. Please reload this page.