vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
# Remove stale threads from the cache.
Remove stale threads from the cache.
Remove stale threads from the cache .
def remove_stale_cached_threads!(cache, &block)
        keys = Set.new(cache.keys)
        Thread.list.each do |thread|
          keys.delete(thread.object_id) if thread.alive?
        end
        keys.each do |key|
          next unless cache.has_key?(key)
          block.call(key, cache[key])
          cache.delete(key)
        end
      end
def remove_stale_cached_threads! ( cache , & block ) keys = Set . new ( cache . keys ) Thread . list . each do | thread | keys . delete ( thread . object_id ) if thread . alive? end keys . each do | key | next unless cache . has_key? ( key ) block . call ( key , cache [ key ] ) cache . delete ( key ) end end
Remove stale threads from the cache.
Remove stale threads from the cache .
cache
block