diff options
Diffstat (limited to 'config/initializers/google_api_client.rb')
-rw-r--r-- | config/initializers/google_api_client.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/config/initializers/google_api_client.rb b/config/initializers/google_api_client.rb index 49a35e5bd7c..ab469e5b0a1 100644 --- a/config/initializers/google_api_client.rb +++ b/config/initializers/google_api_client.rb @@ -10,3 +10,14 @@ require 'signet/errors' # enabling retries is strongly encouraged but disabled by default. Large uploads # that may hit timeouts will mainly benefit from this. Google::Apis::RequestOptions.default.retries = 3 if Gitlab::Utils.to_boolean(ENV.fetch('ENABLE_GOOGLE_API_RETRIES', true)) + +# By default, httpclient will set a send timeout of 120 seconds (https://github.com/nahi/httpclient/blob/82929c4baae14c2319c3f9aba49488c6f6def875/lib/httpclient/session.rb#L147), +# which causes any request to be interrupted every 2 minutes (https://github.com/nahi/httpclient/blob/82929c4baae14c2319c3f9aba49488c6f6def875/lib/httpclient/session.rb#L515). +# +# The Google API client uses resumable uploads so that if a transfer +# request is interrupted, it can retry where it left off. The client +# will retry at most N + 1 times, which means transfers can only last as +# long as this (N + 1) * send timeout. We raise this timeout to an hour +# since otherwise transfers can only last 8 minutes (4 * 2 min) before +# being interrupted. +Google::Apis::ClientOptions.default.send_timeout_sec = 3600 |