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
pull/1981/head
Mattie Conover 2 years ago committed by GitHub
parent 92542e5d3e
commit b25fe7f355
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      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,

Loading…
Cancel
Save