Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A PR to make backoff optional (and disable it for routed connections). It introduces a new
BackoffConfig
structure to provide configurable retry logic for database connections. It replaces the previously hardcoded exponential backoff logic with a more flexible and customizable approach. The changes include updates to configuration structures, builders, and relevant tests, as well as modifications to integrate the new backoff logic into connection management and retry mechanisms.NOTE: The PR is in DRAFT since it is still untested.
New Backoff Configuration:
BackoffConfig
struct with fields formultiplier
,min_delay_ms
,max_delay_ms
, andtotal_delay_ms
, along with a default implementation. This struct allows customization of backoff behavior. (lib/src/config.rs
, lib/src/config.rsR71-R151)BackoffConfigBuilder
to facilitate the construction ofBackoffConfig
instances with optional parameters. (lib/src/config.rs
, lib/src/config.rsR71-R151)Integration with Configuration:
Config
andConfigBuilder
to include an optionalbackoff
field, allowing backoff settings to be specified during configuration. (lib/src/config.rs
, [1] [2]ConfigBuilder
to include a defaultBackoffConfig
. (lib/src/config.rs
, lib/src/config.rsR286)Connection Management:
ConnectionManager
to accept an optionalBackoffConfig
and use it to generate anExponentialBuilder
for retry logic. (lib/src/pool.rs
, [1] [2]create_pool
to pass thebackoff
configuration when creating a connection manager. (lib/src/pool.rs
, lib/src/pool.rsR59)Retry Logic Updates:
Graph
andRoutedConnectionManager
to use the optionalBackoffConfig
. If no backoff is provided, retries are skipped. (lib/src/graph.rs
, [1] [2] [3];lib/src/routing/routed_connection_manager.rs
, [4] [5]Tests:
BackoffConfig
and its integration intoConfig
andConfigBuilder
. Tests now check for proper handling of default and custom backoff configurations. (lib/src/config.rs
, [1] [2] [3] [4]routing/connection_registry.rs
to account for the optionalbackoff
field. (lib/src/routing/connection_registry.rs
, [1] [2]