From 9e3a6d678424728508bf58cee6172731d27a27a1 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 13 Mar 2018 08:15:24 +0100 Subject: Log BackupWorker backtrace, delete Backup if retries exhausted (#6769) --- app/workers/backup_worker.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'app/workers') 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) -- cgit