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

[9.x] Make it so non-existent jobs run down the failed path instead of crashing #42079

Merged
merged 2 commits into from
Apr 21, 2022

Conversation

hdimitrov1
Copy link

@hdimitrov1 hdimitrov1 commented Apr 21, 2022

Hi,

the issue that this is solving is that if you have a queued job (ie in SQS), that you have deleted (or renamed), the runner that picks up the job will fail with an Error.

That means that instead of going down the failed job path and dequeuing the job, it will crash, and keep retrying the job over and over again (in our case 361k times before we ran out of error log allowance).

This makes it instead fail with an Exception and go down the failed job path, so the job dequeues and doesn't keep retrying.

For us this happened to a job that was queued before a deployment in which it was renamed.

@taylorotwell taylorotwell merged commit c3054e2 into laravel:9.x Apr 21, 2022
@GrahamCampbell GrahamCampbell changed the title Make it so non-existent jobs run down the failed path instead of crashing [9.x] Make it so non-existent jobs run down the failed path instead of crashing Apr 21, 2022
@antonkomarev
Copy link
Contributor

antonkomarev commented Apr 22, 2022

I think this is not a best path.
By this way you may lose job and data unexpectedly because it's not so obvious :(

Async jobs renaming may be safely done in multiple steps:

  1. Add job with new name and start dispatching it; remove old job dispatching
  2. Wait until all old jobs in queue will be processed
  3. Delete old job class

@taylorotwell

@hdimitrov1
Copy link
Author

This should still give you an exception and a failed job job so you can rerun it, it just shouldn't infinitely loop while trying to do it - same behaviour as if your job failed for another reason.

@taylorotwell
Copy link
Member

@antonkomarev this PR doesn't prevent that - right? This just prevents infinite retry loops.

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.

3 participants