DataFed icon indicating copy to clipboard operation
DataFed copied to clipboard

Added DB connection back off

Open nedvedba opened this issue 1 year ago • 1 comments

Summary by Sourcery

Add a back-off strategy for database connection retries in the TaskWorker to improve resilience against connection failures.

New Features:

  • Introduce a back-off mechanism for database connection attempts in the TaskWorker to handle connection failures more gracefully.

nedvedba avatar Sep 17 '24 13:09 nedvedba

Reviewer's Guide by Sourcery

This pull request implements a database connection back-off mechanism in the TaskWorker class to handle SDMS DB interface failures more gracefully. The changes introduce an exponential back-off strategy when encountering specific database connection errors.

File-Level Changes

Change Details Files
Implemented database connection back-off mechanism
  • Added a new variable 'db_connection_backoff' to track the current back-off time
  • Initialized 'db_connection_backoff' to 1 second at the start of each task processing loop
  • Reset 'db_connection_backoff' to 1 second after successful task execution
  • Implemented exponential back-off logic when encountering SDMS DB interface failures
  • Added a sleep mechanism using the calculated back-off time
core/server/TaskWorker.cpp

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

sourcery-ai[bot] avatar Sep 17 '24 13:09 sourcery-ai[bot]

@par-hermes format

JoshuaSBrown avatar Oct 30 '24 03:10 JoshuaSBrown