1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Allow users to disable ID generation since some redis providers disable the CLIENT command, fixes #3521

This commit is contained in:
Mike Perham 2017-06-21 04:54:18 -07:00
parent 7941d78f41
commit 33846c849a
2 changed files with 7 additions and 1 deletions

View file

@ -12,7 +12,7 @@ module Sidekiq
options[key.to_sym] = options.delete(key)
end
options[:id] ||= "Sidekiq-#{Sidekiq.server? ? "server" : "client"}-PID-#{$$}"
options[:id] = "Sidekiq-#{Sidekiq.server? ? "server" : "client"}-PID-#{$$}" if !options.has_key?(:id)
options[:url] ||= determine_redis_provider
size = options[:size] || (Sidekiq.server? ? (Sidekiq.options[:concurrency] + 5) : 5)

View file

@ -11,6 +11,12 @@ class TestRedisConnection < Sidekiq::Test
assert_equal "Sidekiq-server-PID-#{$$}", pool.checkout.client.id
end
it "disables client setname with nil id" do
pool = Sidekiq::RedisConnection.create(:id => nil)
assert_equal Redis, pool.checkout.class
assert_equal "redis://127.0.0.1:6379/0", pool.checkout.client.id
end
describe "network_timeout" do
it "sets a custom network_timeout if specified" do
pool = Sidekiq::RedisConnection.create(:network_timeout => 8)