Class: SidekiqUniqueJobs::Server
- Inherits:
-
Object
- Object
- SidekiqUniqueJobs::Server
- Defined in:
- lib/sidekiq_unique_jobs/server.rb
Overview
The unique sidekiq middleware for the server processor
Constant Summary collapse
- DEATH_HANDLER =
(lambda do |job, _ex| return unless (digest = job["lock_digest"]) SidekiqUniqueJobs::Digests.new.delete_by_digest(digest) end).freeze
Class Method Summary collapse
-
.configure(config) ⇒ Sidekiq
Configure the server middleware.
-
.death_handler ⇒ lambda
A death handler for dead jobs.
-
.start ⇒ void
Start the sidekiq unique jobs server process.
-
.stop ⇒ void
Stop the sidekiq unique jobs server process.
Class Method Details
.configure(config) ⇒ Sidekiq
Configure the server middleware
19 20 21 22 23 24 25 26 |
# File 'lib/sidekiq_unique_jobs/server.rb', line 19 def self.configure(config) config.on(:startup) { start } config.on(:shutdown) { stop } return unless config.respond_to?(:death_handlers) config.death_handlers << death_handler end |
.death_handler ⇒ lambda
A death handler for dead jobs
56 57 58 |
# File 'lib/sidekiq_unique_jobs/server.rb', line 56 def self.death_handler DEATH_HANDLER end |
.start ⇒ void
This method returns an undefined value.
Start the sidekiq unique jobs server process
34 35 36 37 38 |
# File 'lib/sidekiq_unique_jobs/server.rb', line 34 def self.start SidekiqUniqueJobs::UpdateVersion.call SidekiqUniqueJobs::Orphans::Manager.start SidekiqUniqueJobs::Orphans::ReaperResurrector.start end |
.stop ⇒ void
This method returns an undefined value.
Stop the sidekiq unique jobs server process
46 47 48 |
# File 'lib/sidekiq_unique_jobs/server.rb', line 46 def self.stop SidekiqUniqueJobs::Orphans::Manager.stop end |