Try to automatically detect when data export is accepted

This commit is contained in:
Tulir Asokan
2022-10-14 13:55:43 +03:00
parent 0bbf64d240
commit 3c22ab7bd1
2 changed files with 16 additions and 1 deletions
+9 -1
View File
@@ -37,9 +37,9 @@ from telethon.tl.types import (
Chat,
ChatForbidden,
InputUserSelf,
Message,
NotifyPeer,
PeerUser,
TypeChat,
TypeUpdate,
UpdateFolderPeers,
UpdateNewChannelMessage,
@@ -403,6 +403,14 @@ class User(DBUser, AbstractUser, BaseUser):
self.log.exception("Error in takeout backfill loop, retrying in an hour")
await asyncio.sleep(3600)
async def _check_server_notice_edit(self, message: Message) -> None:
if "Data export request" in message.message and "Accepted" in message.message:
self.log.debug(
f"Received an edit to message {message.id} that looks like the data export"
" was accepted, marking takeout as retriable"
)
self.takeout_retry_immediate.set()
async def _takeout_and_backfill(self, first_req: Backfill, first_attempt: bool = True) -> None:
self.takeout_retry_immediate.clear()
self.takeout_requested = True