From e6c3454e9fc348b0fab976098d1897a1ea69ece5 Mon Sep 17 00:00:00 2001 From: Adam Van Ymeren Date: Tue, 8 Jul 2025 11:43:32 -0700 Subject: [PATCH] updates: don't try to fetch one more difference when context has been cancelled --- pkg/gotd/telegram/updates/state.go | 3 --- pkg/gotd/telegram/updates/state_channel.go | 4 ---- 2 files changed, 7 deletions(-) diff --git a/pkg/gotd/telegram/updates/state.go b/pkg/gotd/telegram/updates/state.go index 3af094ae..4434b5e6 100644 --- a/pkg/gotd/telegram/updates/state.go +++ b/pkg/gotd/telegram/updates/state.go @@ -169,9 +169,6 @@ func (s *internalState) Run(ctx context.Context) error { for { select { case <-ctx.Done(): - if len(s.pts.pending) > 0 || len(s.qts.pending) > 0 || len(s.seq.pending) > 0 { - s.getDifferenceLogger(ctx) - } return ctx.Err() case u := <-s.externalQueue: ctx := trace.ContextWithSpanContext(ctx, u.span) diff --git a/pkg/gotd/telegram/updates/state_channel.go b/pkg/gotd/telegram/updates/state_channel.go index 756167c6..1cadb64e 100644 --- a/pkg/gotd/telegram/updates/state_channel.go +++ b/pkg/gotd/telegram/updates/state_channel.go @@ -112,10 +112,6 @@ func (s *channelState) Run(ctx context.Context) error { s.log.Debug("Gap timeout") s.getDifferenceLogger(ctx) case <-ctx.Done(): - if len(s.pts.pending) > 0 { - // This will probably fail. - s.getDifferenceLogger(ctx) - } return ctx.Err() case <-s.idleTimeout.C: s.log.Debug("Idle timeout")