instance method remove_stale_cached_threads!

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v2.3.18 Private

Available in: v2.2.3 v2.3.18

Signature

remove_stale_cached_threads!(cache, &block)

Remove stale threads from the cache.

Parameters

cache req
block block
Source
# File activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb, line 231
      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

Defined in activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb line 231 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::ConnectionAdapters::ConnectionPool

Type at least 2 characters to search.

↑↓ navigate · open · esc close