utils: Fix retry delay calculator
authorMichael Hanselmann <hansmi@google.com>
Wed, 3 Feb 2010 12:18:01 +0000 (13:18 +0100)
committerMichael Hanselmann <hansmi@google.com>
Wed, 3 Feb 2010 13:01:10 +0000 (14:01 +0100)
Before this patch, it would always sleep for at least
the time specified as the upper limit. Now it actually
limits the sleep time.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

lib/utils.py

index 1abec0e..50ad64f 100644 (file)
@@ -2107,7 +2107,7 @@ class _RetryDelayCalculator(object):
 
     # Update for next run
     if self._limit is None or self._next < self._limit:
-      self._next = max(self._limit, self._next * self._factor)
+      self._next = min(self._limit, self._next * self._factor)
 
     return current