From e9945761c7038e06b800f749dc042451149f46be Mon Sep 17 00:00:00 2001
From: Kamil Trzcinski <ayufan@ayufan.eu>
Date: Fri, 21 Jul 2017 15:51:33 +0200
Subject: [PATCH] Fix network timeouts

Response Header Timeout cannot be too low, as we long-poll on connection, so we delay pushing headers to client
---
 network/client.go | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/network/client.go b/network/client.go
index d70c33d2e..9cd6430c7 100644
--- a/network/client.go
+++ b/network/client.go
@@ -158,11 +158,13 @@ func (n *client) createTransport() {
 			return dialer.Dial(network, addr)
 		},
 		TLSClientConfig:       &tlsConfig,
+		MaxIdleConns:          100,
+		IdleConnTimeout:       90 * time.Second,
 		TLSHandshakeTimeout:   10 * time.Second,
 		ExpectContinueTimeout: 1 * time.Second,
-		IdleConnTimeout:       30 * time.Second,
-		ResponseHeaderTimeout: 10 * time.Second,
+		ResponseHeaderTimeout: 10 * time.Minute,
 	}
+	n.Timeout = common.DefaultNetworkClientTimeout
 }
 
 func (n *client) getCAChain(tls *tls.ConnectionState) string {
@@ -366,7 +368,6 @@ func newClient(requestCredentials requestCredentials) (c *client, err error) {
 		compatibleWithGitLab: true,
 		requestBackOffs:      make(map[string]*backoff.Backoff),
 	}
-	c.Timeout = common.DefaultNetworkClientTimeout
 
 	host := strings.Split(url.Host, ":")[0]
 	if CertificateDirectory != "" {
-- 
GitLab