Fixed bug: Lost DB connection causes jobs to not be processed anymore. #163
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi there lovely maintainers,
first of all: Thanks for this great gem! It does a great job over at zammad. However, we faced an issue in one of our customers installations. Long story short: The DB connection socket is closed (due to a restarting DB) while Delayed::Job reserves the job. Delayed::Job rescues the raised exception, logs it as INFO(!) and calls the
recover_from
method on the backend and then may try to re-run the job or skips it. An example log entry looks like this:This gem does not utilize the Delayed::Job
recover_from
callback yet. This PR changes that to make sure the DB connection is still present after any exception was raised while processing a job. If the DB connection is lost and can't be reestablished a new exception will be raised and have to be handled accordingly.Sadly I have no clue how to provide tests for this. I tried my best but haven't found out how. Please let me know how you would approach it and I'm happy to add those.
Greetings from Germany 👋