From 5317f2c1db092c9c38c55e2fd23f971cf19b5752 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Fri, 23 Nov 2018 15:59:30 +0000 Subject: [PATCH] (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. --- lib/beaker/hypervisor/vmpooler.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/beaker/hypervisor/vmpooler.rb b/lib/beaker/hypervisor/vmpooler.rb index d5857f6..acb0dce 100644 --- a/lib/beaker/hypervisor/vmpooler.rb +++ b/lib/beaker/hypervisor/vmpooler.rb @@ -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')