From 0f1273fa44a9122bffbd5cecbaea99b1db781d7e Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 14 Apr 2017 11:53:30 +1000 Subject: Add configurable timeout for git fetch and clone operations GitLab uses the import_project method in GitLab Shell, This method uses a timeout for the operation, hardcoded to 800 seconds. With this MR the timeout is now configurable in the gitlab_shell settings. --- lib/gitlab/shell.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/gitlab/shell.rb b/lib/gitlab/shell.rb index 36a871e5bbc..b1d6ea665b7 100644 --- a/lib/gitlab/shell.rb +++ b/lib/gitlab/shell.rb @@ -83,7 +83,7 @@ module Gitlab # Timeout should be less than 900 ideally, to prevent the memory killer # to silently kill the process without knowing we are timing out here. output, status = Popen.popen([gitlab_shell_projects_path, 'import-project', - storage, "#{name}.git", url, '800']) + storage, "#{name}.git", url, "#{Gitlab.config.gitlab_shell.git_timeout}"]) raise Error, output unless status.zero? true end @@ -99,7 +99,7 @@ module Gitlab # fetch_remote("gitlab/gitlab-ci", "upstream") # def fetch_remote(storage, name, remote, forced: false, no_tags: false) - args = [gitlab_shell_projects_path, 'fetch-remote', storage, "#{name}.git", remote, '800'] + args = [gitlab_shell_projects_path, 'fetch-remote', storage, "#{name}.git", remote, "#{Gitlab.config.gitlab_shell.git_timeout}"] args << '--force' if forced args << '--no-tags' if no_tags -- cgit v1.2.1