demarches-normaliennes/app/jobs/cron/fix_missing_antivirus_analysis_job.rb

13 lines
355 B
Ruby
Raw Normal View History

2020-08-05 18:40:47 +02:00
class Cron::FixMissingAntivirusAnalysisJob < Cron::CronJob
2020-12-17 10:54:12 +01:00
self.schedule_expression = "every day at 2 am"
def perform
ActiveStorage::Blob.where(virus_scan_result: ActiveStorage::VirusScanner::PENDING).find_each do |blob|
2020-12-17 10:54:12 +01:00
begin
VirusScannerJob.perform_now(blob)
2020-12-17 10:54:12 +01:00
rescue ActiveStorage::IntegrityError
end
end
end
end