Skip to content

Add helper code to make it easier to retry on connection failures. #673

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

Open
aelfric opened this issue Jan 28, 2025 · 1 comment
Open

Add helper code to make it easier to retry on connection failures. #673

aelfric opened this issue Jan 28, 2025 · 1 comment
Labels
type: enhancement A general enhancement

Comments

@aelfric
Copy link

aelfric commented Jan 28, 2025

Feature Request

Is your feature request related to a problem? Please describe

This is somewhat related to #644 - the SPI defines transient errors vs non transient errors such that a non-transient error cannot be recovered. It seems like most or all connection failures might benefit from a retry. In order to express this logic today, we need to look into the sqlState of the exception and check its error code prefix.

In the current state, we need to need to propagate our own definitions of SQL error codes across multiple applications using this driver in order to express the retry logic we'd like to have.

Describe the solution you'd like

Code like this already exists inside this driver. But it returns a generic non-transient resource exception. Based on the definition in the SPI, I'm not sure that all connection failures should be considered non-transient, but even so,

Would it be possible to either define (and expose) an error specific to connection failures and or introduce some utility method like what is done in the JDBC driver.

Describe alternatives you've considered

The alternative is to continue copying this code across our projects or writing our own small utility library for it.

Teachability, Documentation, Adoption, Migration Strategy

Introducing a new exception type might be considered a breaking change, but I think introducing the utility method like in the JDBC driver could be explained through JavaDoc and the readme for this project might benefit from an example that talks specifically about retry logic.

@aelfric aelfric added the type: enhancement A general enhancement label Jan 28, 2025
@mp911de
Copy link
Collaborator

mp911de commented Jan 29, 2025

Sure. Thanks for reaching out. Do you want to come up with a pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants