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

[11.x] Fix integrity constraint violation on failed_jobs_uuid_unique #53264

Draft
wants to merge 4 commits into
base: 11.x
Choose a base branch
from

Conversation

bytestream
Copy link
Contributor

Fixes #53230

Listeners are bound each time Artisan::call('queue:work') is called, and if DatabaseUuidFailedJobProvider is used, then when a failed job occurs it tries to add it to the database multiple times resulting in an integrity constraint violation on the unique key.

Rather than using the global events system, this PR uses SplObserver / SplSubject (Observer Design pattern) which allows the observer to be overwritten every time Artisan::call('queue:work') is called.

Are you receptive to this? If so I can look at adding a test. If not, please suggest an alternative way about going about fixing the issue. It's unclear to me whether logFailedJob() could just be moved into the worker, but that might result in failed jobs being logged outside of the queue:work command.

Copy link

Thanks for submitting a PR!

Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

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.

Integrity constraint violation on failed_jobs_uuid_unique
1 participant