From f7d014cf62ce348ecf6f17c29010bf02da88c98a Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Wed, 4 Oct 2023 10:08:12 +0100 Subject: [PATCH] Check virus scan result after 5 seconds Currently we wait 2 minutes before checking the virus scan result. This was chosen to guarantee that we get back a result, but most scan results happen a lot sooner, so we could try checking for a result sooner. --- app/forms/teacher_interface/upload_form.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/forms/teacher_interface/upload_form.rb b/app/forms/teacher_interface/upload_form.rb index 4fa41c5819..afb955e40d 100644 --- a/app/forms/teacher_interface/upload_form.rb +++ b/app/forms/teacher_interface/upload_form.rb @@ -72,6 +72,11 @@ def attachments_present def fetch_and_update_malware_scan_results document.uploads.each do |upload| # We need a delay here to ensure that the upload has been scanned before fetching the result. + + FetchMalwareScanResultJob.set(wait: 5.seconds).perform_later( + upload_id: upload.id, + ) + FetchMalwareScanResultJob.set(wait: 2.minutes).perform_later( upload_id: upload.id, )