-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StorageAdapter#upload_file/StorageAdapter#find_by shouldn't open handles #875
Conversation
@@ -30,6 +30,24 @@ class Valkyrie::Specs::CustomResource < Valkyrie::Resource | |||
expect(uploaded_file.valid?(digests: { sha1: sha1 })).to be true | |||
end | |||
|
|||
it "doesn't open a file handle on discovery" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expand the title to include the "doesn't leave a file handle open on upload" piece
pre_open_files = open_files | ||
the_file = storage_adapter.find_by(id: uploaded_file.id) | ||
expect(the_file).to be_kind_of Valkyrie::StorageAdapter::File | ||
# the_file.io |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove?
lib/valkyrie/storage/disk.rb
Outdated
rescue Errno::ENOENT | ||
raise Valkyrie::StorageAdapter::FileNotFound | ||
end | ||
|
||
## Lazy file takes open parameters but doesn't open up a file handle. This |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe say "doesn't leave an open file handle"
Closes #869
This has been tested in Figgy here: https://github.com/pulibrary/figgy/compare/test_new_storage_adapter_requirements