mirror of
https://github.com/minio/minio.git
synced 2025-11-08 21:24:55 -05:00
fix: network failure err check should ignore context canceled errors (#10567)
context canceled errors bubbling up from the network layer has the potential to be misconstrued as network errors, taking prematurely a server offline and triggering a health check routine avoid this potential occurrence.
This commit is contained in:
@@ -112,7 +112,7 @@ func (c *Client) Call(ctx context.Context, method string, values url.Values, bod
|
||||
}
|
||||
resp, err := c.httpClient.Do(req)
|
||||
if err != nil {
|
||||
if xnet.IsNetworkOrHostDown(err) || errors.Is(err, context.DeadlineExceeded) {
|
||||
if xnet.IsNetworkOrHostDown(err) {
|
||||
c.MarkOffline()
|
||||
}
|
||||
return nil, &NetworkError{err}
|
||||
@@ -141,6 +141,9 @@ func (c *Client) Call(ctx context.Context, method string, values url.Values, bod
|
||||
// Limit the ReadAll(), just in case, because of a bug, the server responds with large data.
|
||||
b, err := ioutil.ReadAll(io.LimitReader(resp.Body, c.MaxErrResponseSize))
|
||||
if err != nil {
|
||||
if xnet.IsNetworkOrHostDown(err) {
|
||||
c.MarkOffline()
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
if len(b) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user