gotd: don't emit duplicate updates for channels

This commit is contained in:
Tulir Asokan
2025-12-18 16:36:23 +02:00
parent 09227510bc
commit ced0a2d067
+4 -1
View File
@@ -45,6 +45,7 @@ func (s *internalState) applyCombined(ctx context.Context, comb *tg.UpdatesCombi
)
sortUpdatesByPts(comb.Updates)
nonChannelUpdates := comb.Updates[:0]
for _, u := range comb.Updates {
switch u := u.(type) {
case *tg.UpdatePtsChanged:
@@ -86,6 +87,8 @@ func (s *internalState) applyCombined(ctx context.Context, comb *tg.UpdatesCombi
}); err != nil {
return false, err
}
} else {
nonChannelUpdates = append(nonChannelUpdates, u)
}
if qts, ok := tg.IsQtsUpdate(u); ok {
@@ -96,7 +99,7 @@ func (s *internalState) applyCombined(ctx context.Context, comb *tg.UpdatesCombi
}
if err := s.handler.Handle(ctx, &tg.Updates{
Updates: comb.Updates,
Updates: nonChannelUpdates,
Users: ents.Users,
Chats: ents.Chats,
}); err != nil {