Skip to content

Commit

Permalink
HYC-1868 - Prevent timeout when ingesting large files (#1075)
Browse files Browse the repository at this point in the history
* Set faraday timeout for fedora connections to 5 minutes

* Add comments

* Rubocop

* Also set the timeout via fedora config, in case that impacts any other paths in active-fedora
  • Loading branch information
bbpennel authored Feb 14, 2024
1 parent d7ac497 commit 2e57efb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions app/overrides/lib/active-fedora/fedora_override.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true
# https://github.com/samvera/active_fedora/blob/v14.0.1/lib/active_fedora/fedora.rb
ActiveFedora::Fedora.class_eval do
def authorized_connection
options = {}
options[:ssl] = ssl_options if ssl_options
options[:request] = request_options if request_options
Faraday.new(host, options) do |conn|
conn.response :encoding # use Faraday::Encoding middleware
conn.adapter Faraday.default_adapter # net/http
# [hyc-override] Setting timeout to 5 minutes to allow for deposit of large files (default: 60)
conn.options.timeout = 60 * 5
if Gem::Version.new(Faraday::VERSION) < Gem::Version.new('2')
conn.request :basic_auth, user, password
else
conn.request :authorization, :basic, user, password
end
end
end
end
3 changes: 3 additions & 0 deletions config/fedora.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
default: &default
request:
timeout: 300
development:
user: fedoraAdmin
password: fedoraAdmin
Expand Down

0 comments on commit 2e57efb

Please sign in to comment.