fix race condition with unzipped files' tmp files
the tmp file was getting closed before FileInContext does its thing. Change-Id: Ib2145552e18f9162c0ae87e5626bb5c6a12a3a0b Reviewed-on: https://gerrit.instructure.com/4772 Tested-by: Hudson <hudson@instructure.com> Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
This commit is contained in:
parent
805d605d5c
commit
b4d0163f2c
|
@ -134,7 +134,6 @@ class UnzipAttachment
|
|||
@batch.data[:last_path] = path
|
||||
@batch.save
|
||||
end
|
||||
f.close
|
||||
# This is where the attachment actually happens. See file_in_context.rb
|
||||
attachment = nil
|
||||
begin
|
||||
|
@ -149,6 +148,8 @@ class UnzipAttachment
|
|||
@attachments << attachment if attachment
|
||||
rescue => e
|
||||
@logger.warn "Couldn't unzip archived file #{path}: #{e.message}" if @logger
|
||||
ensure
|
||||
f.close
|
||||
end
|
||||
end
|
||||
updates = []
|
||||
|
|
Loading…
Reference in New Issue