class Sidekiq::RedisClientAdapter
def client_opts(options)
def client_opts(options) opts = options.dup if opts[:namespace] raise ArgumentError, "Your Redis configuration uses the namespace '#{opts[:namespace]}' but this feature isn't supported by redis-client. " \ "Either use the redis adapter or remove the namespace." end opts.delete(:size) opts.delete(:pool_timeout) if opts[:network_timeout] opts[:timeout] = opts[:network_timeout] opts.delete(:network_timeout) end if opts[:driver] opts[:driver] = opts[:driver].to_sym end opts[:name] = opts.delete(:master_name) if opts.key?(:master_name) opts[:role] = opts[:role].to_sym if opts.key?(:role) opts.delete(:url) if opts.key?(:sentinels) # Issue #3303, redis-rb will silently retry an operation. # This can lead to duplicate jobs if Sidekiq::Client's LPUSH # is performed twice but I believe this is much, much rarer # than the reconnect silently fixing a problem; we keep it # on by default. opts[:reconnect_attempts] ||= 1 opts end
def initialize(options)
def initialize(options) opts = client_opts(options) @config = if opts.key?(:sentinels) RedisClient.sentinel(**opts) else RedisClient.config(**opts) end end
def new_client
def new_client CompatClient.new(@config.new_client) end