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

changed #determine_redis_provider to first check against the REDIS_PROVIDER env variable

This commit is contained in:
Chris Sprehe 2013-11-24 08:16:37 -06:00
parent 331d219441
commit da48ce6ded
2 changed files with 16 additions and 3 deletions

View file

@ -11,7 +11,7 @@ module Sidekiq
if url
options[:url] = url
end
# need a connection for Fetcher and Retry
size = options[:size] || (Sidekiq.server? ? (Sidekiq.options[:concurrency] + 2) : 5)
pool_timeout = options[:pool_timeout] || 1
@ -69,9 +69,8 @@ module Sidekiq
def determine_redis_provider
# REDISTOGO_URL is only support for legacy reasons
return ENV['REDISTOGO_URL'] if ENV['REDISTOGO_URL']
provider = ENV['REDIS_PROVIDER'] || 'REDIS_URL'
ENV[provider]
ENV[provider] || ENV['REDISTOGO_URL']
end
end

View file

@ -87,6 +87,20 @@ class TestRedisConnection < Sidekiq::Test
end
end
describe "with REDISTOGO_URL and a parallel REDIS_PROVIDER set" do
it "sets connection URI to the provider" do
uri = 'redis://sidekiq-redis-provider:6379/0'
provider = 'SIDEKIQ_REDIS_PROVIDER'
ENV['REDIS_PROVIDER'] = provider
ENV[provider] = uri
ENV['REDISTOGO_URL'] = 'redis://redis-to-go:6379/0'
with_env_var provider, uri, true
ENV[provider] = nil
end
end
describe "with REDIS_PROVIDER set" do
it "sets connection URI to the provider" do
uri = 'redis://sidekiq-redis-provider:6379/0'