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 37 37: def self.extended(db) 38: pool = db.pool 39: if defined?(ShardedThreadedConnectionPool) && pool.is_a?(ShardedThreadedConnectionPool) 40: pool.extend(ThreadedServerBlock) 41: pool.instance_variable_set(:@default_servers, {}) 42: else 43: pool.extend(UnthreadedServerBlock) 44: pool.instance_variable_set(:@default_servers, []) 45: end 46: end