Skip to content

Commit 28552d5

Browse files
committed
Compute exponential by multiplying previous result
1 parent c2f4e18 commit 28552d5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

backoff/_wait_gen.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ def expo(
2121
"""
2222
# Advance past initial .send() call
2323
yield # type: ignore[misc]
24-
n = 0
24+
a = 1
2525
while True:
26-
a = factor * base ** n
2726
if max_value is None or a < max_value:
28-
yield a
29-
n += 1
27+
yield factor * a
28+
a *= base
3029
else:
3130
yield max_value
3231

0 commit comments

Comments
 (0)