Method: Sequel::ShardedThreadedConnectionPool#all_connections

Defined in:
lib/sequel/connection_pool/sharded_threaded.rb

#all_connectionsObject

Yield all of the available connections, and the ones currently allocated to this thread. This will not yield connections currently allocated to other threads, as it is not safe to operate on them. This holds the mutex while it is yielding all of the connections, which means that until the method’s block returns, the pool is locked.



63
64
65
66
67
68
69
70
71
72
73
# File 'lib/sequel/connection_pool/sharded_threaded.rb', line 63

def all_connections
  t = Sequel.current
  sync do
    @allocated.values.each do |threads|
      threads.each do |thread, conn|
        yield conn if t == thread
      end
    end
    @available_connections.values.each{|v| v.each{|c| yield c}}
  end
end