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:
parent
7941d78f41
commit
33846c849a
2 changed files with 7 additions and 1 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue