Decrement the inflight counter on ConnectionRefused

This commit is contained in:
Jamie Gaskins 2023-07-08 23:10:07 -04:00
parent f13846b133
commit edcfee8861

View file

@ -120,8 +120,11 @@ module DB
resource = if @idle.empty? resource = if @idle.empty?
if can_increase_pool? if can_increase_pool?
@inflight += 1 @inflight += 1
r = unsync { build_resource } begin
@inflight -= 1 r = unsync { build_resource }
ensure
@inflight -= 1
end
r r
else else
unsync { wait_for_available } unsync { wait_for_available }