Class: Chronos::Integrations::Sidekiq::ClientMiddleware
- Inherits:
-
Object
- Object
- Chronos::Integrations::Sidekiq::ClientMiddleware
- Defined in:
- lib/chronos/integrations/sidekiq.rb
Overview
Adds a small allowlisted Chronos context to the Sidekiq job envelope.
Instance Method Summary collapse
- #call(_worker_class, job, _queue, _redis_pool = nil) ⇒ Object
-
#initialize(options = {}) ⇒ ClientMiddleware
constructor
A new instance of ClientMiddleware.
Constructor Details
#initialize(options = {}) ⇒ ClientMiddleware
Returns a new instance of ClientMiddleware.
81 82 83 84 |
# File 'lib/chronos/integrations/sidekiq.rb', line 81 def initialize( = {}) @notifier = [:notifier] || Chronos @clock = [:clock] || proc { Time.now.to_f } end |
Instance Method Details
#call(_worker_class, job, _queue, _redis_pool = nil) ⇒ Object
86 87 88 89 |
# File 'lib/chronos/integrations/sidekiq.rb', line 86 def call(_worker_class, job, _queue, _redis_pool = nil) add_context(job) yield end |