Go: replace httpBatchStore overall timeout with idle-timeout (#1518)

The old timeout mechanism started counting when the client
began trying to connect to the server. This meant that sending
a large batch of chunks could cause the request to fail before
all the data even made it to the server. What we actually want
is to timeout when the connection has been idle for some amount
of time. This means that long server processing times can still
cause clients to time out, but that's probably as it should be.

Towards #1414
This commit is contained in:
cmasone-attic
2016-05-17 13:27:09 -07:00
parent d125446955
commit 590bc69cbc
2 changed files with 4 additions and 4 deletions
+1
View File
@@ -0,0 +1 @@
noms-serve
+3 -4
View File
@@ -77,11 +77,10 @@ type writeRequest struct {
func makeHTTPClient(requestLimit int) *http.Client {
t := http.Transport(*http.DefaultTransport.(*http.Transport))
t.MaxIdleConnsPerHost = requestLimit
// This sets, essentially, an idle-timeout. The timer starts counting AFTER the client has finished sending the entire request to the server. As soon as the client receives the server's response headers, the timeout is canceled.
t.ResponseHeaderTimeout = time.Duration(2) * time.Minute
return &http.Client{
Transport: &t,
Timeout: time.Duration(30) * time.Second,
}
return &http.Client{Transport: &t}
}
func (bhcs *httpBatchStore) Flush() {