Commit c86f7802 authored by Stan Hu's avatar Stan Hu

Merge branch 'sh-fix-grpc-timeouts-backup' into 'master'

Extend gRPC timeouts for Rake tasks

Closes #22398

See merge request gitlab-org/gitlab!19461
parents 3f6cb034 580fc82e
---
title: Extend gRPC timeouts for Rake tasks
merge_request: 19461
author:
type: fixed
...@@ -383,11 +383,15 @@ module Gitlab ...@@ -383,11 +383,15 @@ module Gitlab
end end
def self.long_timeout def self.long_timeout
if Sidekiq.server? if web_app_server?
6.hours
else
default_timeout default_timeout
else
6.hours
end
end end
def self.web_app_server?
defined?(::Unicorn) || defined?(::Puma)
end end
def self.storage_metadata_file_path(storage) def self.storage_metadata_file_path(storage)
......
...@@ -17,6 +17,28 @@ describe Gitlab::GitalyClient do ...@@ -17,6 +17,28 @@ describe Gitlab::GitalyClient do
}) })
end end
describe '.long_timeout' do
context 'default case' do
it { expect(subject.long_timeout).to eq(6.hours) }
end
context 'running in Unicorn' do
before do
stub_const('Unicorn', 1)
end
it { expect(subject.long_timeout).to eq(55) }
end
context 'running in Puma' do
before do
stub_const('Puma', 1)
end
it { expect(subject.long_timeout).to eq(55) }
end
end
describe '.filesystem_id_from_disk' do describe '.filesystem_id_from_disk' do
it 'catches errors' do it 'catches errors' do
[Errno::ENOENT, Errno::EACCES, JSON::ParserError].each do |error| [Errno::ENOENT, Errno::EACCES, JSON::ParserError].each do |error|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment