lib/sidekiq.rb in sidekiq-2.8.0 vs lib/sidekiq.rb in sidekiq-2.9.0
- old
+ new
@@ -25,11 +25,11 @@
:environment => nil,
:timeout => 8,
:profile => false,
}
- def self.❨╯°□°❩╯︵ ┻━┻
+ def self.❨╯°□°❩╯︵┻━┻
puts "Calm down, bro"
end
def self.options
@options ||= DEFAULTS.dup
@@ -66,20 +66,19 @@
defined?(Sidekiq::CLI)
end
def self.redis(&block)
raise ArgumentError, "requires a block" if !block
- @redis ||= Sidekiq::RedisConnection.create
+ @redis ||= Sidekiq::RedisConnection.create(@hash || {})
@redis.with(&block)
end
def self.redis=(hash)
+ return @redis = hash if hash.is_a?(ConnectionPool)
+
if hash.is_a?(Hash)
- @redis = RedisConnection.create(hash)
- options[:namespace] ||= hash[:namespace]
- elsif hash.is_a?(ConnectionPool)
- @redis = hash
+ @hash = hash
else
raise ArgumentError, "redis= requires a Hash or ConnectionPool"
end
end
@@ -111,20 +110,8 @@
Sidekiq::Logging.logger = log
end
def self.poll_interval=(interval)
self.options[:poll_interval] = interval
- end
-
- ##
- # deprecated
- def self.size(*queues)
- return Sidekiq::Stats.new.enqueued if queues.empty?
-
- Sidekiq.redis { |conn|
- conn.multi {
- queues.map { |q| conn.llen("queue:#{q}") }
- }
- }.inject(0) { |memo, count| memo += count }
end
end