Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-11-01 03:10:57 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-11-01 03:10:57 +0300
commit533fed8bd825f93b4b43bd41d41caa38cfc6ae55 (patch)
treebdc5458e4fb19126f705b0786c055d1b9c118748 /lib/gitlab/jira
parent24fb09b2eb3f4703b09eef3c9bbf842cd055626a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/jira')
-rw-r--r--lib/gitlab/jira/http_client.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/gitlab/jira/http_client.rb b/lib/gitlab/jira/http_client.rb
index 7abfe8e38e8..2b8b01e2023 100644
--- a/lib/gitlab/jira/http_client.rb
+++ b/lib/gitlab/jira/http_client.rb
@@ -34,6 +34,17 @@ module Gitlab
request_params[:headers][:Cookie] = get_cookies if options[:use_cookies]
request_params[:base_uri] = uri.to_s
request_params.merge!(auth_params)
+ # Setting defaults here so we can also set `timeout` which prevents setting defaults in the HTTP gem's code
+ request_params[:open_timeout] = options[:open_timeout] || default_timeout_for(:open_timeout)
+ request_params[:read_timeout] = options[:read_timeout] || default_timeout_for(:read_timeout)
+ request_params[:write_timeout] = options[:write_timeout] || default_timeout_for(:write_timeout)
+ # Global timeout. Needs to be at least as high as the maximum defined in other timeouts
+ request_params[:timeout] = [
+ Gitlab::HTTP::DEFAULT_READ_TOTAL_TIMEOUT,
+ request_params[:open_timeout],
+ request_params[:read_timeout],
+ request_params[:write_timeout]
+ ].max
result = Gitlab::HTTP.public_send(http_method, path, **request_params) # rubocop:disable GitlabSecurity/PublicSend
@authenticated = result.response.is_a?(Net::HTTPOK)
@@ -52,6 +63,10 @@ module Gitlab
private
+ def default_timeout_for(param)
+ Gitlab::HTTP::DEFAULT_TIMEOUT_OPTIONS[param]
+ end
+
def auth_params
return {} unless @options[:username] && @options[:password]