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 51 51: def self.extended(db) 52: pool = db.pool 53: if defined?(ShardedThreadedConnectionPool) && pool.is_a?(ShardedThreadedConnectionPool) 54: pool.extend(ThreadedServerBlock) 55: pool.instance_variable_set(:@default_servers, {}) 56: else 57: pool.extend(UnthreadedServerBlock) 58: pool.instance_variable_set(:@default_servers, []) 59: end 60: end