appvault mirror proven 2m0s ago

#2 Add capped exponential backoff open

BLbob-laptop wants to merge feature/backoff cc497087 into main 1bfab332 · opened 2026-09-19 · 1 file changed

Follow-up to #1: doubles the delay per attempt, capped at a limit.

Changes

diff --git a/src/retry.go b/src/retry.go
index f7ece6a..94e14e4 100644
--- a/src/retry.go
+++ b/src/retry.go
@@ -13,3 +13,11 @@ func retry(n int, delay time.Duration, fn func() error) error {
+13 }
+14 return err
+15 }
+16+
+17+// backoff doubles the delay after each failure, capped at limit.
+18+func backoff(d, limit time.Duration) time.Duration {
+19+ if d*2 > limit {
+20+ return limit
+21+ }
+22+ return d * 2
+23+}

Conversation

Comment

Review cc497087

Reviewspolicy: 1 approval, ci
No reviews of the current head yet.
Checks
No checks yet. A runner records one per commit: secretree runner.
needs 1 approval(s) of cc497087, has 0
On the command line:
secretree pr checkout 2
secretree pr diff 2