From ff3d53e142220196971786c71295b9ea8239ddf9 Mon Sep 17 00:00:00 2001 From: KurimuzonAkuma Date: Sat, 1 Jun 2024 00:52:22 +0300 Subject: [PATCH] Write update state to session only if Client.skip_updates = False --- pyrogram/client.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pyrogram/client.py b/pyrogram/client.py index 330f02ca..f109219d 100644 --- a/pyrogram/client.py +++ b/pyrogram/client.py @@ -610,7 +610,7 @@ class Client(Methods): pts = getattr(update, "pts", None) pts_count = getattr(update, "pts_count", None) - if pts: + if pts and not self.skip_updates: await self.storage.update_state( ( utils.get_channel_id(channel_id) if channel_id else 0, @@ -651,15 +651,16 @@ class Client(Methods): self.dispatcher.updates_queue.put_nowait((update, users, chats)) elif isinstance(updates, (raw.types.UpdateShortMessage, raw.types.UpdateShortChatMessage)): - await self.storage.update_state( - ( - 0, - updates.pts, - None, - updates.date, - None + if not self.skip_updates: + await self.storage.update_state( + ( + 0, + updates.pts, + None, + updates.date, + None + ) ) - ) diff = await self.invoke( raw.functions.updates.GetDifference(