Skip to content

Commit

Permalink
push: disable background resync by default
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Jan 29, 2025
1 parent 4319cba commit 9842b65
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pkg/connector/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ var PushMessageFormats = map[string]string{
"STORY_NOTEXT": "%[1]v posted a story",
}

var FullSyncOnConnectBackground = false

func (t *TelegramClient) ConnectBackground(ctx context.Context, params *bridgev2.ConnectBackgroundParams) error {
data, _ := params.ExtraData.(*PushNotificationData)
var relatedPortal *bridgev2.Portal
Expand Down Expand Up @@ -275,12 +277,14 @@ func (t *TelegramClient) ConnectBackground(ctx context.Context, params *bridgev2
FormattedNotification: notificationText,
})
}
t.Connect(ctx)
defer t.Disconnect()
// TODO is it possible to safely only sync one chat?
select {
case <-time.After(20 * time.Second):
case <-ctx.Done():
if FullSyncOnConnectBackground {
t.Connect(ctx)
defer t.Disconnect()
// TODO is it possible to safely only sync one chat?
select {
case <-time.After(20 * time.Second):
case <-ctx.Done():
}
}
return nil
}
Expand Down

0 comments on commit 9842b65

Please sign in to comment.