Skip to content

Commit 4dc2a82

Browse files
DrewProebstelDrew Proebstel
andauthored
Attach script with threads (#228)
* add a new script * include close io * ensure io .close --------- Co-authored-by: Drew Proebstel <[email protected]>
1 parent 323d441 commit 4dc2a82

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

script/attach_submission_pdfs.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,17 @@ def attach(mapping_json_key, bucket_name)
3434
content_type: "application/pdf"
3535
)
3636

37+
io.close
38+
3739
intake.save! if intake.changed?
3840
attached_count += 1
3941
rescue Aws::S3::Errors::NoSuchKey
4042
puts "Missing S3 key #{s3_key} for intake #{intake_id}, skipping"
4143
missing_count += 1
4244
rescue => e
4345
puts "Error attaching for intake #{intake_id}: #{e.class} - #{e.message}"
46+
ensure
47+
io&.close
4448
end
4549
end
4650

0 commit comments

Comments
 (0)