fix(missing-antivirus-job): retry when backend is unavailable

This commit is contained in:
Colin Darie 2023-03-02 17:43:23 +01:00
parent 08666cd852
commit f8f14830a6
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4

View file

@ -3,10 +3,7 @@ class Cron::FixMissingAntivirusAnalysisJob < Cron::CronJob
def perform
ActiveStorage::Blob.where(virus_scan_result: ActiveStorage::VirusScanner::PENDING).find_each do |blob|
begin
VirusScannerJob.perform_now(blob)
rescue ActiveStorage::IntegrityError
end
VirusScannerJob.perform_later(blob)
end
end
end