From caabb6ff00e3ddbda4d631de0156157094e312c3 Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Mon, 17 Jan 2022 11:39:42 +0100 Subject: [PATCH] Fix discarding a job due to non-existant report [SCI-6409] --- app/jobs/reports/docx_job.rb | 3 ++- app/jobs/reports/pdf_job.rb | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/jobs/reports/docx_job.rb b/app/jobs/reports/docx_job.rb index 9be2fcebe..ccd4b5d6b 100644 --- a/app/jobs/reports/docx_job.rb +++ b/app/jobs/reports/docx_job.rb @@ -8,7 +8,8 @@ module Reports queue_as :reports discard_on StandardError do |job, error| - report = Report.find(job.arguments.first) + report = Report.find_by(id: job.arguments.first) + next unless report ActiveRecord::Base.no_touching do report.docx_error! diff --git a/app/jobs/reports/pdf_job.rb b/app/jobs/reports/pdf_job.rb index e70107ac6..c83b280d2 100644 --- a/app/jobs/reports/pdf_job.rb +++ b/app/jobs/reports/pdf_job.rb @@ -12,7 +12,8 @@ module Reports queue_as :reports discard_on StandardError do |job, error| - report = Report.find(job.arguments.first) + report = Report.find_by(id: job.arguments.first) + next unless report ActiveRecord::Base.no_touching do report.pdf_error!