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:
parent
331d219441
commit
da48ce6ded
2 changed files with 16 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in a new issue