make ExponentialRetryTimeout.seconds_to_wait always return an int

This commit is contained in:
Paul Marillonnet 2020-02-06 17:25:43 +01:00
parent 358973c231
commit cc28e9cd69
1 changed files with 6 additions and 6 deletions

View File

@ -52,12 +52,12 @@ class ExponentialRetryTimeout(object):
done.
'''
key = self.key(keys)
if not self.duration:
return 0
now = time.time()
what = cache.get(key)
if what and what[1] > now:
return what[1] - now
if self.duration:
now = time.time()
what = cache.get(key)
if what and what[1] > now:
return what[1] - now
return 0
def success(self, *keys):
'''Signal an action success, delete exponential backoff cache.