Fix UpdateState calling handlers with updates with lower pts

This commit is contained in:
Lonami Exo 2017-09-19 13:17:40 +02:00
parent 060b8a8b9c
commit 1d3273a306

View File

@ -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)