diff --git a/lib/sshkit/backends/connection_pool/cache.rb b/lib/sshkit/backends/connection_pool/cache.rb index 11a09075..7cf579a2 100644 --- a/lib/sshkit/backends/connection_pool/cache.rb +++ b/lib/sshkit/backends/connection_pool/cache.rb @@ -37,7 +37,7 @@ def evict # Peek at the first connection to see if it is still fresh. If so, we can # return right away without needing to use `synchronize`. first_expires_at, first_conn = connections.first - return if (first_expires_at.nil? || fresh?(first_expires_at)) && !closed?(first_conn) + return if (first_expires_at.nil? || fresh?(first_expires_at)) connections.synchronize do fresh, stale = connections.partition do |expires_at, conn|