From 6f5f107e3f319bc417c3de4a1a17616fea9060ba Mon Sep 17 00:00:00 2001 From: Amrith Kumar Date: Fri, 16 Dec 2016 09:49:49 -0500 Subject: [PATCH] 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 --- trove/common/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/trove/common/utils.py b/trove/common/utils.py index 52a3e7f8ef..d846b97b53 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,