mirror of
https://github.com/mautrix/telegram.git
synced 2026-05-17 07:25:46 +03:00
backfill: retry takeout if it gets invalidated
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user