mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Sidekiq::Util is not available on client-side, need to promote, #3474
This commit is contained in:
parent
df99ca982e
commit
1d5b559be9
4 changed files with 13 additions and 13 deletions
|
@ -227,6 +227,16 @@ module Sidekiq
|
|||
# DO NOT RESCUE THIS ERROR IN YOUR WORKERS
|
||||
class Shutdown < Interrupt; end
|
||||
|
||||
def self.constantize(str)
|
||||
names = str.split('::')
|
||||
names.shift if names.empty? || names.first.empty?
|
||||
|
||||
constant = Object
|
||||
names.each do |name|
|
||||
constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
|
||||
end
|
||||
constant
|
||||
end
|
||||
end
|
||||
|
||||
require 'sidekiq/rails' if defined?(::Rails::Engine)
|
||||
|
|
|
@ -134,7 +134,7 @@ module Sidekiq
|
|||
# the Reloader. It handles code loading, db connection management, etc.
|
||||
# Effectively this block denotes a "unit of work" to Rails.
|
||||
@reloader.call do
|
||||
klass = Sidekiq::Util.constantize(job_hash['class'.freeze])
|
||||
klass = Sidekiq.constantize(job_hash['class'.freeze])
|
||||
worker = klass.new
|
||||
worker.jid = job_hash['jid'.freeze]
|
||||
@retrier.local(worker, job_hash, queue) do
|
||||
|
|
|
@ -76,7 +76,7 @@ module Sidekiq
|
|||
true
|
||||
elsif Sidekiq::Testing.inline?
|
||||
payloads.each do |job|
|
||||
klass = Sidekiq::Util.constantize(job['class'])
|
||||
klass = Sidekiq.constantize(job['class'])
|
||||
job['id'] ||= SecureRandom.hex(12)
|
||||
job_hash = Sidekiq.load_json(Sidekiq.dump_json(job))
|
||||
klass.process_job(job_hash)
|
||||
|
@ -309,7 +309,7 @@ module Sidekiq
|
|||
worker_classes = jobs.map { |job| job["class"] }.uniq
|
||||
|
||||
worker_classes.each do |worker_class|
|
||||
Sidekiq::Util.constantize(worker_class).drain
|
||||
Sidekiq.constantize(worker_class).drain
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -60,15 +60,5 @@ module Sidekiq
|
|||
arr.clear
|
||||
end
|
||||
|
||||
def self.constantize(str)
|
||||
names = str.split('::')
|
||||
names.shift if names.empty? || names.first.empty?
|
||||
|
||||
constant = Object
|
||||
names.each do |name|
|
||||
constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
|
||||
end
|
||||
constant
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue