aboutsummaryrefslogtreecommitdiff
path: root/src/block
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-04-07 10:24:20 +0200
committerGitea <gitea@fake.local>2022-04-07 11:49:29 +0200
commitcb5836d53cfa0183d62ce1f20497d87a99ed39a3 (patch)
treefcfb7ccbdebd9c8d9b417bf04fe2a8270b6c2c6a /src/block
parent8e3ee82c3e6370a0a5520f1abf60b09a3feb1050 (diff)
downloadgarage-cb5836d53cfa0183d62ce1f20497d87a99ed39a3.tar.gz
garage-cb5836d53cfa0183d62ce1f20497d87a99ed39a3.zip
Bring maximum exponential backoff time down from 16h to 1h
Diffstat (limited to 'src/block')
-rw-r--r--src/block/manager.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/block/manager.rs b/src/block/manager.rs
index a3c4ec0d..1c04a335 100644
--- a/src/block/manager.rs
+++ b/src/block/manager.rs
@@ -46,6 +46,9 @@ const NEED_BLOCK_QUERY_TIMEOUT: Duration = Duration::from_secs(5);
// and the time when it is retried, with exponential backoff
// (multiplied by 2, 4, 8, 16, etc. for every consecutive failure).
const RESYNC_RETRY_DELAY: Duration = Duration::from_secs(60);
+// The minimum retry delay is 60 seconds = 1 minute
+// The maximum retry delay is 60 seconds * 2^6 = 60 seconds << 6 = 64 minutes (~1 hour)
+const RESYNC_RETRY_DELAY_MAX_BACKOFF_POWER: u64 = 6;
// The delay between the moment when the reference counter
// drops to zero, and the moment where we allow ourselves
@@ -985,7 +988,8 @@ impl ErrorCounter {
}
fn delay_msec(&self) -> u64 {
- (RESYNC_RETRY_DELAY.as_millis() as u64) << std::cmp::min(self.errors - 1, 10)
+ (RESYNC_RETRY_DELAY.as_millis() as u64)
+ << std::cmp::min(self.errors - 1, RESYNC_RETRY_DELAY_MAX_BACKOFF_POWER)
}
fn next_try(&self) -> u64 {
self.last_try + self.delay_msec()