From e8624fd7817b998ab80f5e619df470556e469a9e Mon Sep 17 00:00:00 2001 From: Zakhar Bessarab Date: Sat, 7 Jan 2023 13:13:03 +0400 Subject: [PATCH] lib/promscrape/discoveryutils: use correct timeout for blocking requests (#3609) Signed-off-by: Zakhar Bessarab Signed-off-by: Zakhar Bessarab --- lib/promscrape/discoveryutils/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/promscrape/discoveryutils/client.go b/lib/promscrape/discoveryutils/client.go index 74bab4f3ca..a8c69c85ce 100644 --- a/lib/promscrape/discoveryutils/client.go +++ b/lib/promscrape/discoveryutils/client.go @@ -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)