diff options
| author | Alan Conway <aconway@apache.org> | 2010-05-06 18:53:29 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2010-05-06 18:53:29 +0000 |
| commit | 5bee9733abc18405f6e4f8e059e7fd1487b5ae38 (patch) | |
| tree | 795db232ebe1ef2dfaf8088cfd793dbaa417332a /qpid/python | |
| parent | 041f826462375ae24c0c0feec603b8f6b33453fe (diff) | |
| download | qpid-python-5bee9733abc18405f6e4f8e059e7fd1487b5ae38.tar.gz | |
Correct brokertest.retry logic.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@941852 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python')
| -rw-r--r-- | qpid/python/qpid/brokertest.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/qpid/python/qpid/brokertest.py b/qpid/python/qpid/brokertest.py index e05a172ab4..f78dcf4c35 100644 --- a/qpid/python/qpid/brokertest.py +++ b/qpid/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): |
