-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check jobs before working to see if they have already been received t…
…oo many times. Resolves an issue with the `--timeout` feature where jobs the repeatedly timed out would never be marked as `failed`, as the worker process would be killed before it could reach the failing logic. To maintain compatibility there are now two checks against the number of attempts a job has had, one before working the job and one in the case of an job raising an exception. see #15317 for more details.
- Loading branch information
Max Brokman
committed
Sep 7, 2016
1 parent
e68358d
commit de2e30a
Showing
3 changed files
with
82 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
|
||
namespace Illuminate\Queue; | ||
|
||
|
||
use RuntimeException; | ||
|
||
class AttemptsExceededException extends RuntimeException | ||
{ | ||
// | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Not sure, if i'm doing something wrong, or this code has a problem, but, after upgrading to 5.3.8 version, when I call
php artisan queue:listen
it always throwsmarkJobAsFailedIfAlreadyExceedsMaxAttempts
exception, because$maxTries
is 0 and$job->attempts()
is 1. So condition$job->attempts() <= $maxTries
will be always false. To fix this issue I had to runphp artisan queue:listen --tries=1
.Until this release I had no issue with working with queues, but now I do. I guess, there are 2 options to fix this:
WorkerOptions
maxTries
property to1
.markJobAsFailedIfAlreadyExceedsMaxAttempts
, so it could work with current default params (in this case--tries=0
).