tune(artwork): drop backoff base from 5m to 15s

The exponential retry (base × 4^attempts, cap 48h) started at 5 minutes, so a
single transient failure — a timeout under load, an external blip — parked a
cover for 5 minutes even though a retry seconds later would have resolved it.
Start at 15s instead: transient failures recover almost immediately (15s → 1m
→ 4m → 16m …), while persistent failures still escalate to the 48h cap (now at
the 8th attempt instead of the 5th).
This commit is contained in:
Deluan 2026-07-24 17:09:02 -04:00
parent 61cbd2f5f9
commit 8c7a6f25f8
2 changed files with 12 additions and 10 deletions

View File

@ -22,7 +22,7 @@ import (
const (
workerPollInterval = 5 * time.Second
backoffBase = 5 * time.Minute
backoffBase = 15 * time.Second
backoffCap = 48 * time.Hour
breakerThreshold = 5
breakerProbeAfter = time.Minute

View File

@ -565,13 +565,15 @@ var _ = Describe("backoff", func() {
attempts int
want time.Duration
}{
{0, 5 * time.Minute},
{1, 20 * time.Minute},
{2, 80 * time.Minute},
{3, 320 * time.Minute},
{4, 1280 * time.Minute},
{5, 48 * time.Hour},
{6, 48 * time.Hour},
{0, 15 * time.Second},
{1, 60 * time.Second},
{2, 4 * time.Minute},
{3, 16 * time.Minute},
{4, 64 * time.Minute},
{5, 256 * time.Minute},
{6, 1024 * time.Minute},
{7, 48 * time.Hour},
{8, 48 * time.Hour},
} {
Expect(backoffFor(c.attempts, 0)).To(Equal(c.want), "attempt %d", c.attempts)
}
@ -584,8 +586,8 @@ var _ = Describe("backoff", func() {
})
It("keeps random jitter within +/-20%", func() {
lo := time.Duration(float64(320*time.Minute) * 0.8)
hi := time.Duration(float64(320*time.Minute) * 1.2)
lo := time.Duration(float64(16*time.Minute) * 0.8)
hi := time.Duration(float64(16*time.Minute) * 1.2)
for range 200 {
d := backoff(3)
Expect(d).To(BeNumerically(">=", lo))