summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Rodríguez <alejorro70@gmail.com>2017-01-05 23:56:22 -0300
committerAlejandro Rodríguez <alejorro70@gmail.com>2017-01-19 15:21:41 -0300
commit49a041e4764db26af503a0e5cd3583f8208186c1 (patch)
tree96aac82030baa6c40846695a651783c7bfdc3837
parent730ebf83fc23b373402ac46ef4f4ef812891bc7b (diff)
downloadgitlab-shell-gitaly-post-receive.tar.gz
Be more permissive with Gitaly's connections (for the moment)gitaly-post-receive
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.
-rw-r--r--lib/gitaly_client.rb3
-rw-r--r--lib/gitlab_post_receive.rb3
-rw-r--r--lib/http_client.rb4
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