From 1872d3c62f6e4a079f1f65889ab009054ab24d08 Mon Sep 17 00:00:00 2001 From: Patrick Dawkins Date: Tue, 14 Feb 2023 12:29:30 +0000 Subject: [PATCH] Reset the backoff time on successful connection --- client.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client.go b/client.go index 61772b6..36060cd 100644 --- a/client.go +++ b/client.go @@ -97,6 +97,11 @@ func (c *Client) SubscribeWithContext(ctx context.Context, stream string, handle } defer resp.Body.Close() + // Successful connection: reset the backoff time. + if c.ReconnectStrategy != nil { + c.ReconnectStrategy.Reset() + } + reader := NewEventStreamReader(resp.Body, c.maxBufferSize) eventChan, errorChan := c.startReadLoop(reader)