(maint) random backoff strategy

The retry logic for VMPooler has two issues. 1) Waiting longer than
VMPooler takes to refill the pool to retry introduces excessive delays,
and 2) waiting for a deterministic amount of time means that processes
started at the same time stay in sync causing peak loads.

This change caps the wait time at 15 seconds plus a random wait time,
addressing both issues.
This commit is contained in:
David Schmitt 2018-11-23 15:59:30 +00:00
parent 02684546cb
commit 5317f2c1db

View file

@ -169,7 +169,7 @@ module Beaker
@logger.debug("Retrying provision for vmpooler host after waiting #{wait} second(s)")
sleep wait
waited += wait
last_wait, wait = wait, last_wait + wait
last_wait, wait = wait, [last_wait + wait, 15].min + rand(5)
retry
end
report_and_raise(@logger, e, 'Vmpooler.provision')