From 49a041e4764db26af503a0e5cd3583f8208186c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Rodr=C3=ADguez?= Date: Thu, 5 Jan 2017 23:56:22 -0300 Subject: Be more permissive with Gitaly's connections (for the moment) Gitaly is still in an early stage. Many installations won't have it enabled at this stage. We still want the wiring, but for now we'll prefer to fail fast, until Gitaly is more developed and made a mandatory part of GitLab installations. --- lib/gitaly_client.rb | 3 ++- lib/gitlab_post_receive.rb | 3 ++- lib/http_client.rb | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/gitaly_client.rb b/lib/gitaly_client.rb index 66ea655..aa63abe 100644 --- a/lib/gitaly_client.rb +++ b/lib/gitaly_client.rb @@ -11,7 +11,8 @@ class GitalyClient < HttpClient url = "#{gitaly_url}/post-receive" params = { project: sanitize_path(repo_path) } - resp = post(url, params) + # NOTE: Consider being more permisive with gitaly once it's more robust + resp = post(url, params, read_timeout: 5) resp.code == '200' end diff --git a/lib/gitlab_post_receive.rb b/lib/gitlab_post_receive.rb index ee908d8..950066e 100644 --- a/lib/gitlab_post_receive.rb +++ b/lib/gitlab_post_receive.rb @@ -37,7 +37,8 @@ class GitlabPostReceive end print_merge_request_links(merge_request_urls) - result &&= notify_gitaly + # NOTE: Consider checking Gitaly's success once it's robust and mandatory + notify_gitaly rescue HttpClient::ApiUnreachableError nil end diff --git a/lib/http_client.rb b/lib/http_client.rb index 3c3c242..017bd04 100644 --- a/lib/http_client.rb +++ b/lib/http_client.rb @@ -91,8 +91,8 @@ class HttpClient request(:get, url, {}, options) end - def post(url, params) - request(:post, url, params) + def post(url, params, options = {}) + request(:post, url, params, options) end def cert_store -- cgit v1.2.1