You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.
Obscure Scenario: If you share a single redis instance between multiple services, and use client-side middleware on your Sidekiq server, be warned that it might have to deal with workers from unexpected queues. Sidekiq uses a singe redis set to handle scheduled workers, and any server might requeue a worker that's due to be processed, even if it's not for a queue it was configured to process. When it does so, your middleware might be passed a worker name that does not exist in the current ruby context and you might see uninitialized constant exceptions or similar errors.
Since version 0.8.0 the middleware client is doing a Module.const_get without handling any potential NameError. This causes annoying breakage. I'd like to propose something like this:
defcall(worker_class,msg,queue,redis_pool=nil)# Determine the actual job classklass=msg["args"][0]["job_class"] || worker_classrescueworker_classjob_class=ifklass.is_a?(Class)klasselsifModule.const_defined?(klass)# Ensure constant is defined before attempting access Module.const_get(klass)elsenilend# Store data if the job is a Sidekiq::Status::Workerifjob_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)}store_for_idmsg['jid'],initial_metadata,job_class.new.expiration || @expiration,redis_poolendyieldendend
The text was updated successfully, but these errors were encountered:
From this page: https://github.com/mperham/sidekiq/wiki/Middleware
Since version 0.8.0 the middleware client is doing a
Module.const_get
without handling any potentialNameError
. This causes annoying breakage. I'd like to propose something like this:The text was updated successfully, but these errors were encountered: