Skip to content

Commit e11e666

Browse files
committed
Compute exponential by multiplying previous result
1 parent 0777a0f commit e11e666

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
@@ -13,12 +13,11 @@ def expo(base=2, factor=1, max_value=None):
1313
true exponential sequence exceeds this, the value
1414
of max_value will forever after be yielded.
1515
"""
16-
n = 0
16+
a = 1
1717
while True:
18-
a = factor * base ** n
1918
if max_value is None or a < max_value:
20-
yield a
21-
n += 1
19+
yield factor * a
20+
a *= base
2221
else:
2322
yield max_value
2423

0 commit comments

Comments
 (0)