Method: Sequel::ShardedThreadedConnectionPool#add_servers

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

#add_servers(servers) ⇒ Object

Adds new servers to the connection pool. Allows for dynamic expansion of the potential replicas/shards at runtime. servers argument should be an array of symbols.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/sequel/connection_pool/sharded_threaded.rb', line 35

def add_servers(servers)
  sync do
    servers.each do |server|
      unless @servers.has_key?(server)
        @servers[server] = server
        @available_connections[server] = []
        allocated = {}
        allocated.compare_by_identity
        @allocated[server] = allocated
        @waiters[server] = ConditionVariable.new
      end
    end
  end
end