mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-07-10 08:02:23 +03:00
Remove unnecessary workaround when updating local pts
This commit is contained in:
parent
5a1b9daf4c
commit
c5bf83eb86
|
@ -485,17 +485,18 @@ class MessageBox:
|
||||||
# `local_pts` must be the one before the server pts.
|
# `local_pts` must be the one before the server pts.
|
||||||
local_pts = pts.pts - pts.pts_count
|
local_pts = pts.pts - pts.pts_count
|
||||||
|
|
||||||
# For example, when we're in a channel, we immediately receive:
|
# In a channel, we may immediately receive:
|
||||||
# * ReadChannelInbox (pts = X)
|
# * ReadChannelInbox (pts = X)
|
||||||
# * NewChannelMessage (pts = X, pts_count = 1)
|
# * NewChannelMessage (pts = X, pts_count = 1)
|
||||||
#
|
#
|
||||||
# Notice how both `pts` are the same. If we stored the one from the first, then the second one would
|
# Notice how both `pts` are the same. The first one however would've triggered a gap
|
||||||
# be considered "already handled" and ignored, which is not desirable. Instead, advance local `pts`
|
# because `local_pts` + `pts_count` of 0 would be less than `remote_pts`. So there is
|
||||||
# by `pts_count` (which is 0 for updates not directly related to messages, like reading inbox).
|
# no risk by setting the `local_pts` to match the `remote_pts` here of missing the new
|
||||||
|
# message.
|
||||||
if pts.entry in self.map:
|
if pts.entry in self.map:
|
||||||
self.map[pts.entry].pts = local_pts + pts.pts_count
|
self.map[pts.entry].pts = pts.pts
|
||||||
else:
|
else:
|
||||||
self.map[pts.entry] = State(pts=local_pts + pts.pts_count, deadline=next_updates_deadline())
|
self.map[pts.entry] = State(pts=pts.pts, deadline=next_updates_deadline())
|
||||||
|
|
||||||
return update
|
return update
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user