fix(pool): returning closed resources to the pool (#154)

This commit is contained in:
Stephen von Takach 2021-09-07 08:02:43 +10:00 committed by GitHub
parent bf5ca75d1a
commit 6dc3f2dd6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View file

@ -141,7 +141,9 @@ module DB
idle_pushed = false
sync do
if can_increase_idle_pool
if resource.responds_to?(:closed?) && resource.closed?
@total.delete(resource)
elsif can_increase_idle_pool
@idle << resource
if resource.responds_to?(:after_release)
resource.after_release