Log BackupWorker backtrace, delete Backup if retries exhausted (#6769)

signup-info-prompt
Eugen Rochko 2018-03-13 08:15:24 +01:00 committed by GitHub
parent 8bf3e750ab
commit 9e3a6d6784
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -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)