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

Retry transactions when deadlocked #90

Closed

Conversation

aaronjensen
Copy link

Fixes #63

@albus522
Copy link
Member

The latest DJ already does this. When an Exception occurs while locking a job, DJ logs the error, then continues as normal. If the deadlock occurs 10 times in a row, the process will exit with a FatalBackend error.
https://github.com/collectiveidea/delayed_job/blob/master/lib/delayed/worker.rb#L281

@albus522 albus522 closed this May 16, 2014
@aaronjensen
Copy link
Author

@albus522 thanks for that, unfortunately that only covers one half of the problem. The other half is during the delete, that part is still not trapped and runs the risk of delayed job running the job twice when things deadlock. Would you like me to remove the deadlock trapping for the reserve and add it to the delete? Or would it be better to update delayed_job to make delete more robust? This is a pretty specific issue to MySQL from what I know. See all of the conversation in #63, I'm not alone.

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.

Mysql2::Error: Deadlock when attempting to lock a job
2 participants