Class: SidekiqUniqueJobs::Server::Middleware
- Inherits:
-
Object
- Object
- SidekiqUniqueJobs::Server::Middleware
- Includes:
- Logging, OptionsWithFallback
- Defined in:
- lib/sidekiq_unique_jobs/server/middleware.rb
Overview
The unique sidekiq middleware for the server processor
Constant Summary
Constants included from OptionsWithFallback
Instance Method Summary collapse
-
#call(worker_class, item, queue) { ... } ⇒ Object
Runs the server middleware Used from Sidekiq::Processor#process.
Methods included from OptionsWithFallback
#lock, #lock_class, #lock_type, #log_duplicate_payload?, #options, #unique_disabled?, #unique_enabled?, #unique_type
Methods included from Logging
#log_debug, #log_error, #log_fatal, #log_info, #log_warn, #logger, #logging_context
Instance Method Details
#call(worker_class, item, queue) { ... } ⇒ Object
Runs the server middleware
Used from Sidekiq::Processor#process
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/sidekiq_unique_jobs/server/middleware.rb', line 19 def call(worker_class, item, queue) @worker_class = worker_class @item = item @queue = queue return yield if unique_disabled? SidekiqUniqueJobs::Job.add_uniqueness(item) Sidekiq::Logging.with_context(logging_context(self.class, item)) do lock.execute do yield end end end |