Skip to content

Commit

Permalink
Use constant backoff in handshake retry strategy (#3900)
Browse files Browse the repository at this point in the history
  • Loading branch information
romac committed Mar 22, 2024
1 parent 0783023 commit d223dd1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions crates/relayer/src/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ pub mod channel_handshake_retry {

/// Defines the increment in delay between subsequent retries.
/// A value of `0` will make the retry delay constant.
const DELAY_INCREMENT: Duration = Duration::from_secs(1);
const DELAY_INCREMENT: Duration = Duration::from_secs(0);

/// Maximum number of retries
const MAX_RETRIES: u32 = 10;

/// The default retry strategy.
/// We retry with a growing backoff strategy. The strategy is parametrized by the
/// We retry with a constant backoff strategy. The strategy is parametrized by the
/// maximum block time expressed as a `Duration`.
pub fn default_strategy(max_block_time: Duration) -> impl Iterator<Item = Duration> {
let retry_delay = max_block_time / PER_BLOCK_RETRIES;
Expand Down
4 changes: 2 additions & 2 deletions crates/relayer/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ mod handshake_retry {

/// Defines the increment in delay between subsequent retries.
/// A value of `0` will make the retry delay constant.
const DELAY_INCREMENT: Duration = Duration::from_secs(1);
const DELAY_INCREMENT: Duration = Duration::from_secs(0);

/// Maximum number of retries
const MAX_RETRIES: u32 = 10;

/// The default retry strategy.
/// We retry with a growing backoff strategy. The strategy is parametrized by the
/// We retry with a constant backoff strategy. The strategy is parametrized by the
/// maximum block time expressed as a `Duration`.
pub fn default_strategy(max_block_time: Duration) -> impl Iterator<Item = Duration> {
let retry_delay = max_block_time / PER_BLOCK_RETRIES;
Expand Down

0 comments on commit d223dd1

Please sign in to comment.