-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HYC-1868 - Prevent timeout when ingesting large files (#1075)
* 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
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
default: &default | ||
request: | ||
timeout: 300 | ||
development: | ||
user: fedoraAdmin | ||
password: fedoraAdmin | ||
|