-
Notifications
You must be signed in to change notification settings - Fork 5
Remove timeouts from disk adapters #7022
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
base: main
Are you sure you want to change the base?
Conversation
tpendragon
left a comment
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.
I think I was wrong that we should do this, #6950 wasn't about downtime
|
@hackartisan To expand - I think this test needs to stick around and we have to handle it, but not with Timeout: So I think we can, in fact, remove Timeout. |
| context "when reading from the primary adapter fails" do | ||
| it "falls back to the fallback adapter" do | ||
| allow(Rails.logger).to receive(:warn) | ||
| resource = ScannedResource.new(id: SecureRandom.uuid) | ||
| # Put the file in both places. | ||
| uploaded_file = primary_adapter.upload(file: file, original_filename: "foo.jpg", resource: resource) | ||
| new_path = Pathname.new(uploaded_file.disk_path.to_s.gsub(Figgy.config["repository_path"], Figgy.config["fallback_repository_path"])) | ||
| FileUtils.mkdir_p(new_path.parent) | ||
| FileUtils.cp(uploaded_file.disk_path, new_path) | ||
|
|
||
| file_double = instance_double(File) | ||
| allow(file_double).to receive(:read) do | ||
| # This is what happens when Tigerdata has a database entry, but can't | ||
| # connect to the Isilon. It can get File.size and File.stat, but | ||
| # reading any bytes errors. | ||
| raise Errno::EIO | ||
| end | ||
| allow(File).to receive(:open).and_call_original | ||
| allow(File).to receive(:open).with(uploaded_file.disk_path, "rb").and_yield(file_double) | ||
|
|
||
| reloaded_uploaded_file = storage_adapter.find_by(id: uploaded_file.id) | ||
| expect(reloaded_uploaded_file.id).to eq uploaded_file.id | ||
| expect(Rails.logger).to have_received(:warn).with(/Disk adapter used fallback for /) | ||
| end | ||
| end |
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.
We need to keep this test.
Takes code functionality back to before #6952 and #6942
closes #7014