From 03fc1567f4a1d7e922cbbde3a797845ae6556347 Mon Sep 17 00:00:00 2001 From: Julien Date: Tue, 22 Oct 2024 10:41:52 +0200 Subject: [PATCH] Remote Write: Close connection after 3 retries I propose a change in remote write. If we error out for > 3 times, then we close the connection. This is to htlp with user that are using load balancers and DNS, where the active connection might point to a wrong DNS entry but the load balancer of the old entry is still active, replying 503. Signed-off-by: Julien --- storage/remote/client.go | 1 + 1 file changed, 1 insertion(+) diff --git a/storage/remote/client.go b/storage/remote/client.go index 62218cfba9..07f672c10a 100644 --- a/storage/remote/client.go +++ b/storage/remote/client.go @@ -271,6 +271,7 @@ func (c *Client) Store(ctx context.Context, req []byte, attempt int) (WriteRespo if attempt > 0 { httpReq.Header.Set("Retry-Attempt", strconv.Itoa(attempt)) + httpReq.Close = attempt > 3 } ctx, cancel := context.WithTimeout(ctx, c.timeout)