summaryrefslogtreecommitdiff
path: root/lib/gitlab/git_access.rb
diff options
context:
space:
mode:
authorTiago Botelho <tiagonbotelho@hotmail.com>2018-10-25 09:49:59 +0100
committerTiago Botelho <tiagonbotelho@hotmail.com>2018-10-25 10:10:46 +0100
commitcb5f4d0cad520629aecaa838ddf1e84d7265ff49 (patch)
tree833fef694eb1942fd7818303310e5647d7211e17 /lib/gitlab/git_access.rb
parent084a8b6101c25e5d3d4f97f078abd9a649a2fb64 (diff)
downloadgitlab-ce-cb5f4d0cad520629aecaa838ddf1e84d7265ff49.tar.gz
Refactors TimedLogger to be more OOP compliant
Adds a #full_message method so that external classes do not have access to the state of the logger. Adds a #append_message to always append to the array in-place
Diffstat (limited to 'lib/gitlab/git_access.rb')
-rw-r--r--lib/gitlab/git_access.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb
index 713a98bb556..1da466cbfd6 100644
--- a/lib/gitlab/git_access.rb
+++ b/lib/gitlab/git_access.rb
@@ -27,6 +27,12 @@ module Gitlab
cannot_push_to_read_only: "You can't push code to a read-only GitLab instance."
}.freeze
+ LOG_HEADER = <<~MESSAGE
+ Push operation timed out
+
+ Timing information for debugging purposes:
+ MESSAGE
+
INTERNAL_TIMEOUT = 50.seconds.freeze
DOWNLOAD_COMMANDS = %w{git-upload-pack git-upload-archive}.freeze
PUSH_COMMANDS = %w{git-receive-pack}.freeze
@@ -46,7 +52,7 @@ module Gitlab
end
def check(cmd, changes)
- @logger = Checks::TimedLogger.new(timeout: INTERNAL_TIMEOUT)
+ @logger = Checks::TimedLogger.new(timeout: INTERNAL_TIMEOUT, header: LOG_HEADER)
@changes = changes
check_protocol!
@@ -284,13 +290,7 @@ module Gitlab
change_access.exec
rescue Checks::TimedLogger::TimeoutError
- header = <<~MESSAGE
- Push operation timed out
-
- Timing information for debugging purposes:
- MESSAGE
-
- raise TimeoutError, header + logger.log.join("\n")
+ raise TimeoutError, logger.full_message
end
def deploy_key