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

Upgrade to lazy connection pool so we don't need to be lazy ourself.

This commit is contained in:
Mike Perham 2014-03-13 21:06:39 -07:00
parent bcaa6d43d8
commit 42e887d7c6
3 changed files with 6 additions and 7 deletions

View file

@ -25,6 +25,7 @@ Please see [Upgrading.md](Upgrading.md) for more comprehensive upgrade notes.
- **Remove built-in error integration for Airbrake, Honeybadger, ExceptionNotifier and Exceptional**.
Each error gem should provide its own Sidekiq integration. Update your error gem to the latest
version to pick up Sidekiq support.
- Upgrade to connection\_pool 2.0 which creates connections lazily.
- Remove deprecated Sidekiq::Client.registered\_\* APIs
- Remove deprecated support for the old Sidekiq::Worker#retries\_exhausted method.
- Removed 'sidekiq/yaml\_patch', this was never documented or recommended.

View file

@ -68,17 +68,15 @@ module Sidekiq
def self.redis(&block)
raise ArgumentError, "requires a block" if !block
@redis ||= Sidekiq::RedisConnection.create(@hash || {})
@redis ||= Sidekiq::RedisConnection.create
@redis.with(&block)
end
def self.redis=(hash)
return @redis = hash if hash.is_a?(ConnectionPool)
if hash.is_a?(Hash)
@hash = hash
@redis = if hash.is_a?(ConnectionPool)
hash
else
raise ArgumentError, "redis= requires a Hash or ConnectionPool"
Sidekiq::RedisConnection.create(hash)
end
end

View file

@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
gem.version = Sidekiq::VERSION
gem.add_dependency 'redis', '>= 3.0.6'
gem.add_dependency 'redis-namespace', '>= 1.3.1'
gem.add_dependency 'connection_pool', '>= 1.0.0'
gem.add_dependency 'connection_pool', '>= 2.0.0'
gem.add_dependency 'celluloid', '>= 0.15.2'
gem.add_dependency 'json'
gem.add_development_dependency 'sinatra'