mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
(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:
parent
8be578493a
commit
faaec4f9bc
2 changed files with 3 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue