Decrement the inflight counter on ConnectionRefused (#184)

This commit is contained in:
Jamie Gaskins 2023-07-10 09:55:35 -04:00 committed by GitHub
parent 851091e81c
commit ce95cd2257
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

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