Skip to content

Commit

Permalink
fix(telegram): reset backoff until reconnectUntilClosed
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed Oct 8, 2024
1 parent eaeb789 commit 951db34
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions telegram/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 951db34

Please sign in to comment.