Skip to content

Commit 528354d

Browse files
Always write update state to storage
If you have a high-load bot and don't need this feature then use custom storage
1 parent 8207dc1 commit 528354d

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

pyrogram/client.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ class Client(Methods):
178178
179179
skip_updates (``bool``, *optional*):
180180
Pass True to skip pending updates that arrived while the client was offline.
181+
Doesn't work if *in_memory* is set to True.
181182
Defaults to True.
182183
183184
takeout (``bool``, *optional*):
@@ -816,7 +817,7 @@ async def handle_updates(self, updates):
816817
pts = getattr(update, "pts", None)
817818
pts_count = getattr(update, "pts_count", None)
818819

819-
if pts and not self.skip_updates:
820+
if pts:
820821
await self.storage.update_state(
821822
(
822823
utils.get_channel_id(channel_id) if channel_id else 0,
@@ -858,16 +859,15 @@ async def handle_updates(self, updates):
858859

859860
self.dispatcher.updates_queue.put_nowait((update, users, chats))
860861
elif isinstance(updates, (raw.types.UpdateShortMessage, raw.types.UpdateShortChatMessage)):
861-
if not self.skip_updates:
862-
await self.storage.update_state(
863-
(
864-
0,
865-
updates.pts,
866-
None,
867-
updates.date,
868-
None
869-
)
862+
await self.storage.update_state(
863+
(
864+
0,
865+
updates.pts,
866+
None,
867+
updates.date,
868+
None
870869
)
870+
)
871871

872872
diff = await self.invoke(
873873
raw.functions.updates.GetDifference(

pyrogram/methods/advanced/recover_gaps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async def recover_gaps(self: "pyrogram.Client") -> Tuple[int, int]:
3333
3434
.. note::
3535
36-
To use this method, you must set the ``Client.skip_updates`` parameter to False, otherwise updates state saving and recovery will not work.
36+
To use this method, you must set the ``Client.skip_updates`` and ``Client.in_memory`` parameter to False, otherwise updates state saving and recovery will not work.
3737
3838
.. include:: /_includes/usable-by/users-bots.rst
3939

0 commit comments

Comments
 (0)