summaryrefslogtreecommitdiff
path: root/trove/common
diff options
context:
space:
mode:
authorAmrith Kumar <amrith@tesora.com>2016-12-16 09:49:49 -0500
committeramrith <amrith.kumar@gmail.com>2017-01-15 23:04:48 +0000
commit6f5f107e3f319bc417c3de4a1a17616fea9060ba (patch)
tree975388ad2b0a4c4d9e3c3266011b79975e59a3f8 /trove/common
parent523efe23140db10e376e747acb597ab6560a12b6 (diff)
downloadtrove-6f5f107e3f319bc417c3de4a1a17616fea9060ba.tar.gz
backoff in poll_until
The current implementation of poll_until will attempt the retriever every second and given that the call itself may take some time, this effectively ends up being a non-existant sleep. On the under-powered CI systems, this has an unwanted bad effect with polls running continuously. Changing poll_until to use the BackOffLoopingCall instead. Change-Id: I9487d753e65c4de7753d9db19626497217c71f63 Depends-On: Id5be526a0418db5d00cbf5cbceb4993274989e72
Diffstat (limited to 'trove/common')
-rw-r--r--trove/common/utils.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/trove/common/utils.py b/trove/common/utils.py
index 52a3e7f8..d846b97b 100644
--- a/trove/common/utils.py
+++ b/trove/common/utils.py
@@ -199,8 +199,10 @@ def build_polling_task(retriever, condition=lambda value: value,
if time_out is not None and time.time() - start_time > time_out:
raise exception.PollTimeOut
- return loopingcall.FixedIntervalLoopingCall(
- f=poll_and_check).start(sleep_time, initial_delay=False)
+ return loopingcall.BackOffLoopingCall(
+ f=poll_and_check).start(initial_delay=False,
+ starting_interval=sleep_time,
+ max_interval=30, timeout=time_out)
def poll_until(retriever, condition=lambda value: value,