Skip to content
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

[5.4] Make job fail only if it not failed already #20654

Merged
merged 1 commit into from
Aug 23, 2017
Merged

Conversation

netpok
Copy link
Contributor

@netpok netpok commented Aug 21, 2017

This will prevent calling statsJob on an already failed and therefore deleted job, which would create another exception.

In case of beanstalk queue driver this will make queue worker to correctly report MaxAttemptsExceededException instead of Pheanstalk ServerException.

This will prevent calling statsJob on an already failed and therefore deleted job, which would create another exception.

In case of beanstalk queue driver this will make queue worker to correctly report MaxAttemptsExceededException instead of Pheanstalk ServerException.
@netpok netpok changed the title Make job fail only if it not failed already [5.4] Make job fail only if it not failed already Aug 21, 2017
@taylorotwell
Copy link
Member

Eh, how do you recreate this situation?

@netpok
Copy link
Contributor Author

netpok commented Aug 21, 2017

I can only speak in the case of beanstalk queue driver:

Steps to recreate:

  • Use beanstalk queue driver
  • Make a job that will timeout
  • After reaching the limit it will produce the mentioned exception on the next attempt

Reason:
The markJobAsFailedIfAlreadyExceedsMaxAttempts will fail the job and delete from the queue and then throw a MaxAttemptsExceededException. This exception will be catched and processed with the handleJobException, which will call markJobAsFailedIfWillExceedMaxAttempts and that function will try to stat the already deleted job by calling the $job->attempts() method.

Stack trace: https://pastebin.com/L3wG1kX4

@taylorotwell taylorotwell merged commit 060e421 into laravel:5.4 Aug 23, 2017
themsaid added a commit that referenced this pull request Aug 24, 2017
@netpok netpok deleted the 5.4 branch September 11, 2019 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants