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
This commit is contained in:
Amrith Kumar 2016-12-16 09:49:49 -05:00 committed by amrith
parent 523efe2314
commit 6f5f107e3f
1 changed files with 4 additions and 2 deletions

View File

@ -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,