Skip to content

Automatically retry enqueuing after connection reset#294

Merged
ukd1 merged 1 commit intoQueueClassic:masterfrom
borgand:retry_enqueue_on_pgerror
Jul 3, 2019
Merged

Automatically retry enqueuing after connection reset#294
ukd1 merged 1 commit intoQueueClassic:masterfrom
borgand:retry_enqueue_on_pgerror

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