mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-30 04:20:53 +00:00
Disable keep alives, fix return on last retry. #297
This commit is contained in:
+5
-1
@@ -43,7 +43,8 @@ func NewClient(rt *ResilientTransport) *http.Client {
|
|||||||
}
|
}
|
||||||
return c, nil
|
return c, nil
|
||||||
},
|
},
|
||||||
Proxy: http.ProxyFromEnvironment,
|
DisableKeepAlives: true,
|
||||||
|
Proxy: http.ProxyFromEnvironment,
|
||||||
}
|
}
|
||||||
// TODO: Would be nice is ResilientTransport allowed clients to initialize
|
// TODO: Would be nice is ResilientTransport allowed clients to initialize
|
||||||
// with http.Transport attributes.
|
// with http.Transport attributes.
|
||||||
@@ -77,6 +78,9 @@ func (t *ResilientTransport) tries(req *http.Request) (res *http.Response, err e
|
|||||||
if !t.ShouldRetry(req, res, err) {
|
if !t.ShouldRetry(req, res, err) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
if try == MaxTries-1 {
|
||||||
|
break
|
||||||
|
}
|
||||||
if res != nil {
|
if res != nil {
|
||||||
res.Body.Close()
|
res.Body.Close()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user