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
BackoffConfigstructure 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:
BackoffConfigstruct 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)BackoffConfigBuilderto facilitate the construction ofBackoffConfiginstances with optional parameters. (lib/src/config.rs, lib/src/config.rsR71-R151)Integration with Configuration:
ConfigandConfigBuilderto include an optionalbackofffield, allowing backoff settings to be specified during configuration. (lib/src/config.rs, [1] [2]ConfigBuilderto include a defaultBackoffConfig. (lib/src/config.rs, lib/src/config.rsR286)Connection Management:
ConnectionManagerto accept an optionalBackoffConfigand use it to generate anExponentialBuilderfor retry logic. (lib/src/pool.rs, [1] [2]create_poolto pass thebackoffconfiguration when creating a connection manager. (lib/src/pool.rs, lib/src/pool.rsR59)Retry Logic Updates:
GraphandRoutedConnectionManagerto 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:
BackoffConfigand its integration intoConfigandConfigBuilder. Tests now check for proper handling of default and custom backoff configurations. (lib/src/config.rs, [1] [2] [3] [4]routing/connection_registry.rsto account for the optionalbackofffield. (lib/src/routing/connection_registry.rs, [1] [2]