# File lib/mongo/server/connection_pool/queue.rb, line 294 def close_stale_sockets! check_count_invariants return unless max_idle_time mutex.synchronize do i = 0 while i < queue.length connection = queue[i] if last_checkin = connection.last_checkin if (Time.now - last_checkin) > max_idle_time connection.disconnect! queue.delete_at(i) @pool_size -= 1 next end end i += 1 end end ensure check_count_invariants end