diff --git a/common/lib/dependabot/shared_helpers.rb b/common/lib/dependabot/shared_helpers.rb index b2b7f8ffbb0..6068c33b0c0 100644 --- a/common/lib/dependabot/shared_helpers.rb +++ b/common/lib/dependabot/shared_helpers.rb @@ -153,6 +153,7 @@ def self.excon_defaults(options = nil) connect_timeout: 5, write_timeout: 5, read_timeout: 20, + retry_limit: 4, # Excon defaults to four retries, but let's set it explicitly for clarity omit_default_port: true, middlewares: excon_middleware, headers: excon_headers(headers) diff --git a/common/spec/dependabot/shared_helpers_spec.rb b/common/spec/dependabot/shared_helpers_spec.rb index 2449f760e90..5206652579d 100644 --- a/common/spec/dependabot/shared_helpers_spec.rb +++ b/common/spec/dependabot/shared_helpers_spec.rb @@ -304,6 +304,7 @@ def existing_tmp_folders connect_timeout: 5, write_timeout: 5, read_timeout: 20, + retry_limit: 4, omit_default_port: true, middlewares: described_class.excon_middleware, headers: described_class.excon_headers diff --git a/maven/lib/dependabot/maven/file_parser/repositories_finder.rb b/maven/lib/dependabot/maven/file_parser/repositories_finder.rb index 96c15d5bca9..88488e507d4 100644 --- a/maven/lib/dependabot/maven/file_parser/repositories_finder.rb +++ b/maven/lib/dependabot/maven/file_parser/repositories_finder.rb @@ -113,6 +113,11 @@ def fetch_remote_parent_pom(group_id, artifact_id, version, repo_urls) @maven_responses[url] ||= Excon.get( url, idempotent: true, + # We attempt to find dependencies in private repos before failing over to the CENTRAL_REPO_URL, + # but this can burn a lot of a job's time against slow servers due to our `read_timeout` being 20 seconds. + # + # In order to avoid the overall job timing out, we only make one retry attempt + retry_limit: 1, **SharedHelpers.excon_defaults ) next unless @maven_responses[url].status == 200