Skip to content

Commit

Permalink
Guard against nil tempfiles in MARC export job
Browse files Browse the repository at this point in the history
Why these changes are being introduced:

If a tempfile has already been closed and unlinked, the `ensure`
block in MarcExportJob#perform will throw an error.

Relevant ticket(s):

* https://mitlibraries.atlassian.net/browse/ETD-546

How this addresses that need:

This checks if the tempfile exists before attempting to close it.

Side effects of this change:

None.
  • Loading branch information
jazairi committed Feb 22, 2022
1 parent 9643ddb commit 1a0644e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/jobs/marc_export_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def perform(theses)
zip_file = MarcBatch.new(theses, marc_filename, zip_filename).build
BatchMailer.marc_batch_email(zip_filename, zip_file, theses).deliver_now
ensure
zip_file.close
zip_file.close if zip_file
end
end

Expand Down

0 comments on commit 1a0644e

Please sign in to comment.