mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Redis should be auto-initialized without any configuration on the client-side
This commit is contained in:
parent
00501031df
commit
0a9a12cee8
3 changed files with 7 additions and 4 deletions
|
@ -4,7 +4,10 @@ require 'sidekiq/worker'
|
||||||
require 'sidekiq/rails' if defined?(::Rails)
|
require 'sidekiq/rails' if defined?(::Rails)
|
||||||
|
|
||||||
module Sidekiq
|
module Sidekiq
|
||||||
class << self
|
def self.redis
|
||||||
attr_accessor :redis
|
@redis ||= Sidekiq::RedisConnection.create
|
||||||
|
end
|
||||||
|
def self.redis=(r)
|
||||||
|
@redis = r
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,7 @@ module Sidekiq
|
||||||
def self.create(options={})
|
def self.create(options={})
|
||||||
url = options[:url] || ENV['REDISTOGO_URL'] || 'redis://localhost:6379/0'
|
url = options[:url] || ENV['REDISTOGO_URL'] || 'redis://localhost:6379/0'
|
||||||
client = build_client(url, options[:namespace])
|
client = build_client(url, options[:namespace])
|
||||||
return ConnectionPool.new(:timeout => 1, :size => 25) { client } unless options[:use_pool] == false
|
return ConnectionPool.new(:timeout => 1, :size => (options[:size] || 15)) { client } unless options[:use_pool] == false
|
||||||
client
|
client
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Sidekiq.redis = Sidekiq::RedisConnection.create(:namespace => 'resque')
|
Sidekiq.redis = Sidekiq::RedisConnection.create(:namespace => 'resque', :size => 5)
|
||||||
|
|
Loading…
Add table
Reference in a new issue