mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-30 05:13:45 +03:00
Fix UpdateState calling handlers with updates with lower pts
This commit is contained in:
parent
060b8a8b9c
commit
1d3273a306
|
@ -75,12 +75,16 @@ class UpdateState:
|
||||||
with self._updates_lock:
|
with self._updates_lock:
|
||||||
if isinstance(update, tl.updates.State):
|
if isinstance(update, tl.updates.State):
|
||||||
self._state = update
|
self._state = update
|
||||||
elif not hasattr(update, 'pts') or update.pts > self._state.pts:
|
return # Nothing else to be done
|
||||||
self._state.pts = getattr(update, 'pts', self._state.pts)
|
|
||||||
|
|
||||||
if self._polling:
|
pts = getattr(update, 'pts', self._state.pts)
|
||||||
self._updates.append(update)
|
if pts <= self._state.pts:
|
||||||
self._updates_available.set()
|
return # We already handled this update
|
||||||
|
|
||||||
|
self._state.pts = pts
|
||||||
|
if self._polling:
|
||||||
|
self._updates.append(update)
|
||||||
|
self._updates_available.set()
|
||||||
|
|
||||||
for handler in self.handlers:
|
for handler in self.handlers:
|
||||||
handler(update)
|
handler(update)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user