diff --git a/lib/sshkit/backends/connection_pool/cache.rb b/lib/sshkit/backends/connection_pool/cache.rb index 11a09075..df09a29f 100644 --- a/lib/sshkit/backends/connection_pool/cache.rb +++ b/lib/sshkit/backends/connection_pool/cache.rb @@ -36,8 +36,8 @@ def push(conn) 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) + first_expires_at, _first_conn = connections.first + return if (first_expires_at.nil? || fresh?(first_expires_at)) connections.synchronize do fresh, stale = connections.partition do |expires_at, conn|