From b25fe7f35559659296798fce38725e85bc307116 Mon Sep 17 00:00:00 2001 From: Mattie Conover Date: Tue, 21 Mar 2023 12:11:43 -0700 Subject: [PATCH] Change relayer backoff scaling (#1973) ### Description This adds more backoff to earlier requests so that a request which is sent when there are no others won't be retired constantly until it ends up in the 5min backoff phase. ### Drive-by changes None ### Related issues - Fixes #1896 ### Backward compatibility _Are these changes backward compatible?_ Yes _Are there any infrastructure implications, e.g. changes that would prohibit deploying older commits using this infra tooling?_ None ### Testing _What kind of testing have these changes undergone?_ Unit Tests --- rust/agents/relayer/src/msg/serial_submitter.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rust/agents/relayer/src/msg/serial_submitter.rs b/rust/agents/relayer/src/msg/serial_submitter.rs index 02abd96e2..58220d138 100644 --- a/rust/agents/relayer/src/msg/serial_submitter.rs +++ b/rust/agents/relayer/src/msg/serial_submitter.rs @@ -193,11 +193,13 @@ impl SerialSubmitter { None => return Ok(()), }; - if msg.num_retries >= 16 { + if msg.num_retries >= 1 { let required_duration = Duration::from_secs(match msg.num_retries { - i if i < 16 => unreachable!(), - // wait 5 min - i if (16..24).contains(&i) => 60 * 5, + i if i < 1 => unreachable!(), + // wait 10s for the first few attempts; this prevents thrashing + i if (1..12).contains(&i) => 10, + // wait 90s to 19.5min with a linear increase + i if (12..24).contains(&i) => (i as u64 - 11) * 90, // exponential increase + 30 min; -21 makes it so that at i = 32 it will be // ~60min timeout (64min to be more precise). i => (2u64).pow(i - 21) + 60 * 30,