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,9 +75,13 @@ 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)
pts = getattr(update, 'pts', self._state.pts)
if pts <= self._state.pts:
return # We already handled this update
self._state.pts = pts
if self._polling: if self._polling:
self._updates.append(update) self._updates.append(update)
self._updates_available.set() self._updates_available.set()