Skip to content

Commit

Permalink
Merge pull request #1251 from sul-dlss/1250-timeout
Browse files Browse the repository at this point in the history
Set an absurd HTTP timeout for IIIF requests; fixes #1250
  • Loading branch information
jcoyne authored Aug 20, 2024
2 parents e68389f + 39c5c9d commit 1ec34af
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/iiif_image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def initialize(stacks_file:, transformation:, base_uri: Settings.imageserver.bas
def response
with_retries max_tries: 3, rescue: [HTTP::ConnectionError] do
benchmark "Fetch #{image_url}" do
HTTP.timeout(connect: 15)
HTTP.timeout(connect: 15, read_timeout: 5.minutes)
.headers(user_agent: "#{HTTP::Request::USER_AGENT} (#{Settings.user_agent})")
.use({ normalize_uri: { normalizer: lambda(&:itself) } })
.get(image_url)
Expand Down
2 changes: 1 addition & 1 deletion app/services/iiif_metadata_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def retrieve
handle_response(
# Disable url normalization as an upstream bug in addressable causes issues for `+`
# https://github.com/sporkmonger/addressable/issues/386
HTTP.timeout(connect: 15)
HTTP.timeout(connect: 15, read_timeout: 5.minutes)
.headers(user_agent: "#{HTTP::Request::USER_AGENT} (#{Settings.user_agent})")
.use({ normalize_uri: { normalizer: lambda(&:itself) } }).get(@url)
)
Expand Down

0 comments on commit 1ec34af

Please sign in to comment.