lib/sidekiq-status/client_middleware.rb in sidekiq-status-1.0.2 vs lib/sidekiq-status/client_middleware.rb in sidekiq-status-1.1.0

- old
+ new

@@ -19,13 +19,19 @@ # @param [ConnectionPool] redis_pool optional redis connection pool def call(worker_class, msg, queue, redis_pool=nil) # Determine the actual job class klass = msg["args"][0]["job_class"] || worker_class rescue worker_class - job_class = klass.is_a?(Class) ? klass : Module.const_get(klass) + job_class = if klass.is_a?(Class) + klass + elsif Module.const_defined?(klass) + Module.const_get(klass) + else + nil + end # Store data if the job is a Sidekiq::Status::Worker - if job_class.ancestors.include?(Sidekiq::Status::Worker) + if job_class && job_class.ancestors.include?(Sidekiq::Status::Worker) initial_metadata = { jid: msg['jid'], status: :queued, worker: Sidekiq::Job.new(msg, queue).display_class, args: display_args(msg, queue)