-
Notifications
You must be signed in to change notification settings - Fork 154
Implement exponential backoff when creating a database connection #718
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
base: master
Are you sure you want to change the base?
Conversation
The existing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run ./gradlew spotlessApply
and commit, to fix the build error :)
The existing createDataSource method would be cleaner without debug-logging every time we create a new SQL connection, as the connectionFactory could just be passed straight through to the new RetryingConnectionFactory. What do you think of this? Should I remove the debug log?
We could just move the debug-log into your new class. I think its useful to have and that way we could have both, the neater syntax and the log :)
Whats the behavior when starting/reloading bluemap with a broken/wrong database connection config? E.g. wrong connection-url / credentials?
I feel like retrying with a bad hostname or bad credentials would not be good, also we need to display the error in those cases to inform whats wrong. 🤔
I will do some testing with different invalid SQL configs soon and post them here in the comments. End result is also still the same with this approach - after the fifth caught exception, it just throws it like the old implementation would. That stacktrace will provide you with whats wrong, e.g. connection refused (the Maybe it's good to provide the exception message in each warning log after the caught SQL exceptions, just in case the reason for the exception is different than the last one (thats currently thrown). |
I think we can close this PR @TBlueF. It's a lot more hassle than it's worth, at least for me. Some of the issues I saw:
I only wanted to fix the error spam since the connection to my SQL server isn't stable. I think this is definitely something worth looking at for BlueMap, but I'll just fork the project and ignore the exception once caught as a hack for my own usecase. |
I agree that an error spam should be fixed/limited .. |
Avoid error spam when the SQL server is (temporarily) offline. Without this, multiple stacktraces are written to the console per second.