lib/promscrape/discoveryutils: use correct timeout for blocking requests (#3609)

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>
This commit is contained in:
Zakhar Bessarab 2023-01-07 13:13:03 +04:00 committed by Aliaksandr Valialkin
parent eb9a542c1f
commit e8624fd781
No known key found for this signature in database
GPG Key ID: A72BEC6CD3D0DED1

View File

@ -207,7 +207,7 @@ func (c *Client) getAPIResponseWithParamsAndClient(client *HTTPClient, path stri
return nil, fmt.Errorf("cannot parse %q: %w", requestURL, err)
}
deadline := time.Now().Add(client.WriteTimeout)
deadline := time.Now().Add(client.ReadTimeout)
ctx, cancel := context.WithDeadline(c.clientCtx, deadline)
defer cancel()
req, err := http.NewRequestWithContext(ctx, "GET", u.String(), nil)