about summary refs log tree commit diff
path: root/config
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-03-31 21:59:03 +0200
committerGitHub <noreply@github.com>2020-03-31 21:59:03 +0200
commit9014367bd87e07941134259d87f4d2c327ff37d4 (patch)
treecb1ae1a1ccc716951e6bfaf9280e6324c288c4b7 /config
parent1fb92037e432913902a5e5c8a5b673b036d84cb8 (diff)
Fix background jobs not using locks like they are supposed to (#13361)
Also:

- Fix locks not being removed when jobs go to the dead job queue
- Add UI for managing locks to the Sidekiq dashboard
- Remove unused Sidekiq workers

Fix #13349
Diffstat (limited to 'config')
-rw-r--r--config/initializers/sidekiq.rb5
-rw-r--r--config/routes.rb2
2 files changed, 6 insertions, 1 deletions
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb
index 288453a04..f2733562f 100644
--- a/config/initializers/sidekiq.rb
+++ b/config/initializers/sidekiq.rb
@@ -13,6 +13,11 @@ Sidekiq.configure_server do |config|
   config.server_middleware do |chain|
     chain.add SidekiqErrorHandler
   end
+
+  config.death_handlers << lambda do |job, _ex|
+    digest = job['lock_digest']
+    SidekiqUniqueJobs::Digests.delete_by_digest(digest) if digest
+  end
 end
 
 Sidekiq.configure_client do |config|
diff --git a/config/routes.rb b/config/routes.rb
index 89d446d10..49ab851e2 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-require 'sidekiq/web'
+require 'sidekiq_unique_jobs/web'
 require 'sidekiq-scheduler/web'
 
 Sidekiq::Web.set :session_secret, Rails.application.secrets[:secret_key_base]