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

Automatically retry enqueuing after connection reset #294

Merged
merged 1 commit into from
Jul 3, 2019

Conversation

borgand
Copy link
Contributor

@borgand borgand commented Jan 5, 2018

If DB connection is dropped for any reason, QC does reset the connection but does not retry enqueuing the job.

This PR adds retry-once logic to enqueue and enqueue_in (and through that to enqueue_at) so that when the initial execute fails with PGError, it is retried once (after execute's rescue has reset the connection).

Rationale: QC should give it's best to ensure the enqueue results in a enqueued job in DB, so if the DB connection has gone bad, resetting it is not enough and we should repeat the INSERT also. Leaving the retry logic to the app code is sub-optimal as then everybody need to implement the same code.
I added the retry only to enqueue and enqueue_in, not to execute, so that other SQL statements can be executed without automatically retrying on PGError.

@ukd1 ukd1 merged commit 0e77e31 into QueueClassic:master Jul 3, 2019
ukd1 added a commit that referenced this pull request Jul 3, 2019
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