Catch DatabaseError exceptions and send RetryInfo error

Before raising this MR, consider whether the following are required, and complete if so:

  • Unit tests
  • Add a unit test that is able to extract the RetryInfo duration value to ensure that we've set the context correctly

If not required, please explain in brief why not.

Description

When database connections are unexpectedly closed, throw a home-grown exception which can be caught and acted upon to inform clients to retry. Consolidate the pool disposal code into a separate class to facilitate reuse.

Changes proposed in this merge request:

  • Move all the pool dispose code into it's own class to reduce code duplication and facilitate code reuse.
  • Add logic to detect if a pool was disposed, and if so throw a specific exception which can then be caught in the various service.py files. From there, create a RetryInfo message which instructs clients to realize that a retry is possible and how long to wait before doing so.

Validation

Please note steps the reviewer should take to be able to test this MR; any necessary setup they might need, what results they should be looking for to verify.

Issues addressed

Closes / Resolves / Addresses (delete as appropriate) issue <e.g. repo-name#x>

Edited by Frank Kolarek

Merge request reports

Loading