mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
replace redis connection temp var with accessor
This commit is contained in:
parent
5e04fa3deb
commit
7fc2601421
1 changed files with 8 additions and 4 deletions
|
@ -15,12 +15,10 @@ module Sidekiq
|
|||
end
|
||||
|
||||
def self.connect
|
||||
r = Redis.connect(:url => url)
|
||||
|
||||
if namespace
|
||||
Redis::Namespace.new(namespace, :redis => r)
|
||||
Redis::Namespace.new(namespace, :redis => redis_connection)
|
||||
else
|
||||
r
|
||||
redis_connection
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -31,5 +29,11 @@ module Sidekiq
|
|||
def self.url
|
||||
@url || ENV['REDISTOGO_URL'] || 'redis://localhost:6379/0'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def self.redis_connection
|
||||
Redis.connect(:url => url)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue