Module | Sequel::ServerBlock |
In: |
lib/sequel/extensions/server_block.rb
|
Enable the server block on the connection pool, choosing the correct extension depending on whether the connection pool is threaded or not. Also defines the with_server method on the receiver for easy use.
# File lib/sequel/extensions/server_block.rb, line 38 38: def self.extended(db) 39: pool = db.pool 40: if defined?(ShardedThreadedConnectionPool) && pool.is_a?(ShardedThreadedConnectionPool) 41: pool.extend(ThreadedServerBlock) 42: pool.instance_variable_set(:@default_servers, {}) 43: else 44: pool.extend(UnthreadedServerBlock) 45: pool.instance_variable_set(:@default_servers, []) 46: end 47: end