mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
StandardRB style fixes
This commit is contained in:
parent
ea5e0b6cbe
commit
148afbf077
7 changed files with 16 additions and 16 deletions
|
@ -154,7 +154,7 @@ module Sidekiq
|
|||
|
||||
def self.default_worker_options=(hash)
|
||||
# stringify
|
||||
@default_worker_options = default_worker_options.merge(Hash[hash.map {|k, v| [k.to_s, v]}])
|
||||
@default_worker_options = default_worker_options.merge(Hash[hash.map { |k, v| [k.to_s, v] }])
|
||||
end
|
||||
|
||||
def self.default_worker_options
|
||||
|
|
|
@ -86,8 +86,8 @@ module Sidekiq
|
|||
|
||||
pipe2_res = Sidekiq.redis { |conn|
|
||||
conn.pipelined do
|
||||
processes.each {|key| conn.hget(key, "busy") }
|
||||
queues.each {|queue| conn.llen("queue:#{queue}") }
|
||||
processes.each { |key| conn.hget(key, "busy") }
|
||||
queues.each { |queue| conn.llen("queue:#{queue}") }
|
||||
end
|
||||
}
|
||||
|
||||
|
@ -790,7 +790,7 @@ module Sidekiq
|
|||
# or Sidekiq Pro.
|
||||
def leader
|
||||
@leader ||= begin
|
||||
x = Sidekiq.redis {|c| c.get("dear-leader") }
|
||||
x = Sidekiq.redis { |c| c.get("dear-leader") }
|
||||
# need a non-falsy value so we can memoize
|
||||
x ||= ""
|
||||
x
|
||||
|
|
|
@ -112,7 +112,7 @@ module Sidekiq
|
|||
end
|
||||
|
||||
if cleanup.size > 0
|
||||
jobs = cleanup.map {|p| p.job }.compact
|
||||
jobs = cleanup.map { |p| p.job }.compact
|
||||
|
||||
logger.warn { "Terminating #{cleanup.size} busy worker threads" }
|
||||
logger.warn { "Work still in progress #{jobs.inspect}" }
|
||||
|
|
|
@ -65,11 +65,11 @@ module Sidekiq
|
|||
end
|
||||
|
||||
def enable(*opts)
|
||||
opts.each {|key| set(key, true) }
|
||||
opts.each { |key| set(key, true) }
|
||||
end
|
||||
|
||||
def disable(*opts)
|
||||
opts.each {|key| set(key, false) }
|
||||
opts.each { |key| set(key, false) }
|
||||
end
|
||||
|
||||
# Helper for the Sinatra syntax: Sidekiq::Web.set(:session_secret, Rails.application.secrets...)
|
||||
|
@ -114,11 +114,11 @@ module Sidekiq
|
|||
end
|
||||
|
||||
def enable(*opts)
|
||||
opts.each {|key| set(key, true) }
|
||||
opts.each { |key| set(key, true) }
|
||||
end
|
||||
|
||||
def disable(*opts)
|
||||
opts.each {|key| set(key, false) }
|
||||
opts.each { |key| set(key, false) }
|
||||
end
|
||||
|
||||
def set(attribute, value)
|
||||
|
@ -187,7 +187,7 @@ module Sidekiq
|
|||
end
|
||||
end
|
||||
|
||||
middlewares.each {|middleware, block| use(*middleware, &block) }
|
||||
middlewares.each { |middleware, block| use(*middleware, &block) }
|
||||
|
||||
run WebApplication.new(klass)
|
||||
end
|
||||
|
|
|
@ -23,10 +23,10 @@ module Sidekiq
|
|||
end
|
||||
|
||||
def params
|
||||
indifferent_hash = Hash.new {|hash, key| hash[key.to_s] if Symbol === key }
|
||||
indifferent_hash = Hash.new { |hash, key| hash[key.to_s] if Symbol === key }
|
||||
|
||||
indifferent_hash.merge! request.params
|
||||
route_params.each {|k, v| indifferent_hash[k.to_s] = v }
|
||||
route_params.each { |k, v| indifferent_hash[k.to_s] = v }
|
||||
|
||||
indifferent_hash
|
||||
end
|
||||
|
@ -81,7 +81,7 @@ module Sidekiq
|
|||
private
|
||||
|
||||
def _erb(file, locals)
|
||||
locals&.each {|k, v| define_singleton_method(k) { v } unless singleton_methods.include? k}
|
||||
locals&.each { |k, v| define_singleton_method(k) { v } unless singleton_methods.include? k }
|
||||
|
||||
if file.is_a?(String)
|
||||
ERB.new(file).result(binding)
|
||||
|
|
|
@ -342,7 +342,7 @@ module Sidekiq
|
|||
|
||||
def self.run_hooks(hooks, app, action)
|
||||
hooks.select { |p, _| !p || p =~ action.env[WebRouter::PATH_INFO] }
|
||||
.each {|_, b| action.instance_exec(action.env, app, &b) }
|
||||
.each { |_, b| action.instance_exec(action.env, app, &b) }
|
||||
end
|
||||
|
||||
def self.befores
|
||||
|
|
|
@ -24,7 +24,7 @@ module Sidekiq
|
|||
attr_accessor :jid
|
||||
|
||||
def self.included(base)
|
||||
raise ArgumentError, "You cannot include Sidekiq::Worker in an ActiveJob: #{base.name}" if base.ancestors.any? {|c| c.name == "ActiveJob::Base" }
|
||||
raise ArgumentError, "You cannot include Sidekiq::Worker in an ActiveJob: #{base.name}" if base.ancestors.any? { |c| c.name == "ActiveJob::Base" }
|
||||
|
||||
base.extend(ClassMethods)
|
||||
base.sidekiq_class_attribute :sidekiq_options_hash
|
||||
|
@ -124,7 +124,7 @@ module Sidekiq
|
|||
# options for a specific job.
|
||||
def sidekiq_options(opts = {})
|
||||
# stringify
|
||||
self.sidekiq_options_hash = get_sidekiq_options.merge(Hash[opts.map {|k, v| [k.to_s, v]}])
|
||||
self.sidekiq_options_hash = get_sidekiq_options.merge(Hash[opts.map { |k, v| [k.to_s, v] }])
|
||||
end
|
||||
|
||||
def sidekiq_retry_in(&block)
|
||||
|
|
Loading…
Reference in a new issue