From 951db34b9d3779b87634681fcce8fa354c24ec51 Mon Sep 17 00:00:00 2001 From: Aleksandr Razumov Date: Tue, 8 Oct 2024 12:45:31 +0300 Subject: [PATCH] fix(telegram): reset backoff until reconnectUntilClosed --- telegram/connect.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/telegram/connect.go b/telegram/connect.go index a4d484f567..f0140e52e5 100644 --- a/telegram/connect.go +++ b/telegram/connect.go @@ -63,13 +63,14 @@ func (c *Client) reconnectUntilClosed(ctx context.Context) error { b := tdsync.SyncBackoff(backoff.WithContext(c.connBackoff(), ctx)) g := tdsync.NewCancellableGroup(ctx) g.Go(func(ctx context.Context) error { - select { - case <-ctx.Done(): - return ctx.Err() - case <-c.ready.Ready(): - // Reset backoff on successful connection. - b.Reset() - return nil + for { + select { + case <-ctx.Done(): + return ctx.Err() + case <-c.ready.Ready(): + // Reset backoff on successful connection. + b.Reset() + } } }) g.Go(func(ctx context.Context) error {