(POOLER-124) Fix evaluation of max_tries

This commit updates usage of max_tries to ensure that the increment of the try value happens after evaluation of whether max_tries has been exceeded. Without this change max_tries doesn't work as advertised. Additionally, checking looks to see if try is greater than or equal to so the try count exceeding max_tries would also be detected.
This commit is contained in:
kirby@puppetlabs.com 2018-07-03 11:24:05 -07:00
parent 8be578493a
commit faaec4f9bc
2 changed files with 3 additions and 10 deletions

View file

@ -407,10 +407,10 @@ module Vmpooler
metrics.increment('connect.open')
return connection
rescue => err
try += 1
metrics.increment('connect.fail')
raise err if try == max_tries
raise err if try >= max_tries
sleep(try * retry_factor)
try += 1
retry
end
end