summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2010-05-06 18:53:29 +0000
committerAlan Conway <aconway@apache.org>2010-05-06 18:53:29 +0000
commitfc5b5223c76ea5d9774bec77591c7b190270bea7 (patch)
tree1839994460eed30e90ed13eae5ae89a052be3a7e /python
parenta2621fc79260bfc6c60fc76bf95940a7939b9df4 (diff)
downloadqpid-python-fc5b5223c76ea5d9774bec77591c7b190270bea7.tar.gz
Correct brokertest.retry logic.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@941852 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python')
-rw-r--r--python/qpid/brokertest.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/python/qpid/brokertest.py b/python/qpid/brokertest.py
index e05a172ab4..f78dcf4c35 100644
--- a/python/qpid/brokertest.py
+++ b/python/qpid/brokertest.py
@@ -94,12 +94,12 @@ def retry(function, timeout=5, delay=.01):
"""Call function until it returns True or timeout expires.
Double the delay for each retry. Return True if function
returns true, False if timeout expires."""
- elapsed = 0
while not function():
- elapsed += delay
- if elapsed > timeout: return False
- delay *= 2
+ if delay > timeout: delay = timeout
time.sleep(delay)
+ timeout -= delay
+ if timeout <= 0: return False
+ delay *= 2
return True
class Popen(popen2.Popen3):