Skip to content
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

Merged
merged 5 commits into from
Oct 18, 2021

Conversation

tpendragon
Copy link
Collaborator

@tpendragon tpendragon commented Oct 15, 2021

@tpendragon tpendragon marked this pull request as ready for review October 15, 2021 02:04
@@ -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
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove?

rescue Errno::ENOENT
raise Valkyrie::StorageAdapter::FileNotFound
end

## Lazy file takes open parameters but doesn't open up a file handle. This
Copy link
Contributor

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"

@hackartisan hackartisan merged commit 7084e58 into main Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Valkyrie StorageAdapter Files shouldn't open a file handle on instantiation
2 participants