Class: PatientHttp::Sidekiq::Context::Middleware
- Inherits:
-
Object
- Object
- PatientHttp::Sidekiq::Context::Middleware
- Includes:
- Sidekiq::ServerMiddleware
- Defined in:
- lib/patient_http/sidekiq/context.rb
Overview
Sidekiq server middleware that sets the current job context.
This middleware only activates for RequestWorker, which is the only worker that needs access to the job context for re-enqueueing.
Instance Method Summary collapse
Instance Method Details
#call(worker, job, queue) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/patient_http/sidekiq/context.rb', line 21 def call(worker, job, queue) # Only set context for RequestWorker (the only worker that needs it) if job["class"] == PatientHttp::Sidekiq::RequestWorker.name PatientHttp::Sidekiq::Context.with_job(job) do yield end else yield end end |