From 4bcb6c85c2e203d4fe0365994f2fb1ce179ca8e8 Mon Sep 17 00:00:00 2001 From: Patrick Dawkins Date: Tue, 14 Feb 2023 11:17:01 +0000 Subject: [PATCH] Reset the backoff time on successful connection --- client.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client.go b/client.go index 78c936e..180e79e 100644 --- a/client.go +++ b/client.go @@ -96,6 +96,9 @@ func (c *Client) SubscribeWithContext(ctx context.Context, stream string, handle } defer resp.Body.Close() + // Successful connection: reset the backoff time. + c.ReconnectStrategy.Reset() + reader := NewEventStreamReader(resp.Body, c.maxBufferSize) eventChan, errorChan := c.startReadLoop(reader)