tenseleyflow/shithub / 9886174

Browse files

rename worker Backoff const cap_ → maxDelay

Authored by espadonne
SHA
98861741a2d3ac4564793afb81a26879b7b77921
Parents
b6ae85d
Tree
5a2f0a1

1 changed file

StatusFile+-
M internal/worker/types.go 6 6
internal/worker/types.gomodified
@@ -108,20 +108,20 @@ func Backoff(attempts int, jitter func() float64) time.Duration {
108108
 		attempts = 1
109109
 	}
110110
 	const (
111
-		base = 30 * time.Second
112
-		cap_ = time.Hour
111
+		base     = 30 * time.Second
112
+		maxDelay = time.Hour
113113
 	)
114114
 	// Compute base * 2^(attempts-1), guarding against overflow.
115115
 	d := base
116116
 	for i := 1; i < attempts; i++ {
117117
 		d *= 2
118
-		if d >= cap_ {
119
-			d = cap_
118
+		if d >= maxDelay {
119
+			d = maxDelay
120120
 			break
121121
 		}
122122
 	}
123
-	if d > cap_ {
124
-		d = cap_
123
+	if d > maxDelay {
124
+		d = maxDelay
125125
 	}
126126
 	if jitter != nil {
127127
 		// jitter() in [0,1) → multiplier in [0.8, 1.2)