backfill: retry takeout if it gets invalidated

This commit is contained in:
Tulir Asokan
2026-03-19 16:14:04 +02:00
parent 7f71e5f09c
commit 800c15f7b7
2 changed files with 0 additions and 8 deletions

View File

@@ -41,10 +41,6 @@ var (
// getTakeoutID blocks until the takeout ID is available.
func (t *TelegramClient) getTakeoutID(ctx context.Context) (takeoutID int64, err error) {
if t.metadata.TakeoutInvalidated {
// TODO should we just backfill without takeout here?
return 0, fmt.Errorf("takeout invalidated, cannot backfill")
}
// Always stop the takeout timeout timer
if t.stopTakeoutTimer != nil {
t.stopTakeoutTimer.Stop()
@@ -196,7 +192,6 @@ func (t *TelegramClient) FetchMessages(ctx context.Context, fetchParams bridgev2
if err != nil {
if tgerr.Is(err, tg.ErrTakeoutInvalid) {
t.metadata.TakeoutID = 0
t.metadata.TakeoutInvalidated = true
err := t.userLogin.Save(ctx)
if err != nil {
log.Err(err).Msg("Failed to save user login after clearing takeout ID")

View File

@@ -88,8 +88,6 @@ type UserLoginMetadata struct {
Session UserLoginSession `json:"session"`
TakeoutID int64 `json:"takeout_id,omitempty"`
TakeoutInvalidated bool `json:"takeout_invalidated,omitempty"`
DialogSyncComplete bool `json:"takeout_portal_crawl_done,omitempty"`
DialogSyncCursor networkid.PortalID `json:"takeout_portal_crawl_cursor,omitempty"`
DialogSyncCount int `json:"dialog_sync_count,omitempty"`
@@ -102,7 +100,6 @@ type UserLoginMetadata struct {
func (u *UserLoginMetadata) ResetOnLogout() {
u.Session.AuthKey = nil
u.TakeoutID = 0
u.TakeoutInvalidated = false
u.DialogSyncComplete = false
u.DialogSyncCursor = networkid.PortalID("")
u.DialogSyncCount = 0