Add Backoff.current to get value without stepping forward.
This commit is contained in:
parent
5d83ed655d
commit
adc4247efd
1 changed files with 5 additions and 1 deletions
|
@ -24,10 +24,14 @@ class Backoff:
|
||||||
raise ValueError(f'max must be positive, not {max}.')
|
raise ValueError(f'max must be positive, not {max}.')
|
||||||
self.max = max
|
self.max = max
|
||||||
|
|
||||||
def next(self):
|
def current(self):
|
||||||
y = self._calc()
|
y = self._calc()
|
||||||
if self.max is not None:
|
if self.max is not None:
|
||||||
y = min(y, self.max)
|
y = min(y, self.max)
|
||||||
|
return y
|
||||||
|
|
||||||
|
def next(self):
|
||||||
|
y = self.current()
|
||||||
self.x += 1
|
self.x += 1
|
||||||
return y
|
return y
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue