about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-03-13 08:15:24 +0100
committerGitHub <noreply@github.com>2018-03-13 08:15:24 +0100
commit9e3a6d678424728508bf58cee6172731d27a27a1 (patch)
tree2eafadd2512ef8ff9eb2e0a24b47a0f505c1c72e /app
parent8bf3e750ab1d4f4ffa7063b088870d7a82ad548c (diff)
Log BackupWorker backtrace, delete Backup if retries exhausted (#6769)
Diffstat (limited to 'app')
-rw-r--r--app/workers/backup_worker.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/workers/backup_worker.rb b/app/workers/backup_worker.rb
index ec6db4e9e..e4c609d70 100644
--- a/app/workers/backup_worker.rb
+++ b/app/workers/backup_worker.rb
@@ -3,7 +3,16 @@
 class BackupWorker
   include Sidekiq::Worker
 
-  sidekiq_options queue: 'pull'
+  sidekiq_options queue: 'pull', backtrace: true, retry: 5, dead: false
+
+  sidekiq_retries_exhausted do |msg|
+    backup_id = msg['args'].first
+
+    ActiveRecord::Base.connection_pool.with_connection do
+      backup = Backup.find(backup_id)
+      backup&.destroy
+    end
+  end
 
   def perform(backup_id)
     backup = Backup.find(backup_id)