From 599f72bc6ebf5597598ecdcb741005836aa27d4c Mon Sep 17 00:00:00 2001 From: Mike Perham Date: Wed, 25 Feb 2015 11:19:21 -0800 Subject: [PATCH] Hack for #67 to close discarded connections eagerly --- lib/connection_pool/timed_stack.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/connection_pool/timed_stack.rb b/lib/connection_pool/timed_stack.rb index c9b933b..5715ad0 100644 --- a/lib/connection_pool/timed_stack.rb +++ b/lib/connection_pool/timed_stack.rb @@ -126,6 +126,9 @@ class ConnectionPool::TimedStack if @shutdown_block @shutdown_block.call(obj) else + if obj.respond_to?(:close) + obj.close rescue nil + end @created -= 1 end