Merge pull request #5808 from betagouv/fix_missing_antivirus_analysis
Add cron to complete missing analysis
This commit is contained in:
commit
515781b3ce
1 changed files with 12 additions and 0 deletions
12
app/jobs/cron/fix_missing_antivirus_analysis_job.rb
Normal file
12
app/jobs/cron/fix_missing_antivirus_analysis_job.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
class Cron::FixMissingAntivirusAnalysis < Cron::CronJob
|
||||
self.schedule_expression = "every day at 2 am"
|
||||
|
||||
def perform
|
||||
ActiveStorage::Blob.where("metadata like '%\"virus_scan_result\":\"pending%'").each do |b|
|
||||
begin
|
||||
VirusScannerJob.perform_now(b)
|
||||
rescue ActiveStorage::IntegrityError
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue