Add cron to complete missing analysis
This commit is contained in:
parent
03107d095b
commit
1348b883e3
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