mirror of
https://github.com/minio/minio.git
synced 2025-11-10 05:59:43 -05:00
Remove MaxConnsPerHost settings to avoid potential hangs (#10438)
MaxConnsPerHost can potentially hang a call without any way to timeout, we do not need this setting for our proxy and gateway implementations instead IdleConn settings are good enough. Also ensure to use NewRequestWithContext and make sure to take the disks offline only for network errors. Fixes #10304
This commit is contained in:
@@ -109,7 +109,7 @@ func (target *WebhookTarget) IsActive() (bool, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
|
||||
req, err := http.NewRequest(http.MethodHead, target.args.Endpoint.String(), nil)
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodHead, target.args.Endpoint.String(), nil)
|
||||
if err != nil {
|
||||
if xnet.IsNetworkOrHostDown(err) {
|
||||
return false, errNotConnected
|
||||
@@ -117,9 +117,9 @@ func (target *WebhookTarget) IsActive() (bool, error) {
|
||||
return false, err
|
||||
}
|
||||
|
||||
resp, err := target.httpClient.Do(req.WithContext(ctx))
|
||||
resp, err := target.httpClient.Do(req)
|
||||
if err != nil {
|
||||
if xnet.IsNetworkOrHostDown(err) || err == context.DeadlineExceeded {
|
||||
if xnet.IsNetworkOrHostDown(err) || errors.Is(err, context.DeadlineExceeded) {
|
||||
return false, errNotConnected
|
||||
}
|
||||
return false, err
|
||||
|
||||
Reference in New Issue
Block a user