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

Basic pool & healthcheck query to handle broken connections #35

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kamil-certat
Copy link

As already mentioned e.g. in #12, Fody isn't capable to handle closed DB connections. They may happen due to DB restart, network issues etc.

This change introduces a basic usage of connection pool in the Events API code. In addition, because pool ensures recreating connections, but the broken state isn't known until execution of any query, the code executes a simple health check to trigger the pool to act. It prevents serving broken connection on first try after the break.

To simplify handling the connection, the rollback was moved to the query function.

This PR is intended as a hotfix for issue we are observing regularly when using Events API, so other places or possible improvements were intentionally left unchanged.

Sebastian Wagner and others added 3 commits January 20, 2020 17:12
Basic connection pool & healthcheck usage to avoid
failing on broken connections. Rollback was moved to
query function to make it easier to manage the connection.
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.

1 participant