From c4142753d03f6079472ed2ef95ca0ee2c50565c5 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 19 Mar 2018 01:08:34 +0100 Subject: [PATCH 1/3] Handle minified channel updates --- pyrogram/client/client.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 9c49058a..e0a16c2b 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -616,6 +616,28 @@ class Client: ) or getattr(update, "channel_id", None) pts = getattr(update, "pts", None) + pts_count = getattr(update, "pts_count", None) + + if isinstance(update, types.UpdateNewChannelMessage): + diff = self.send( + functions.updates.GetChannelDifference( + channel=self.resolve_peer(update.message.to_id.channel_id), + filter=types.ChannelMessagesFilter( + ranges=[types.MessageRange( + min_id=update.message.id, + max_id=update.message.id + )] + ), + pts=pts - pts_count, + limit=pts + ) + ) + + self.fetch_peers(diff.users) + self.fetch_peers(diff.chats) + + updates.users += diff.users + updates.chats += diff.chats if channel_id and pts: if channel_id not in self.channels_pts: From 390b0c12e2b665ac5069784da8e2ea0d66c15894 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 19 Mar 2018 01:08:59 +0100 Subject: [PATCH 2/3] Set updates_workers to 1 --- pyrogram/client/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index e0a16c2b..5e0d06ba 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -121,7 +121,7 @@ class Client: INVITE_LINK_RE = re.compile(r"^(?:https?://)?(?:t\.me/joinchat/)?([\w-]+)$") DIALOGS_AT_ONCE = 100 - UPDATES_WORKERS = 2 + UPDATES_WORKERS = 1 DOWNLOAD_WORKERS = 1 def __init__(self, From 310f9080c428b7f8f186f38e63663bd4784eb5bc Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 19 Mar 2018 01:54:45 +0100 Subject: [PATCH 3/3] Remove unnecessary method calls --- pyrogram/client/client.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index 10171347..80b07628 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -633,9 +633,6 @@ class Client: ) ) - self.fetch_peers(diff.users) - self.fetch_peers(diff.chats) - updates.users += diff.users updates.chats += diff.chats