diff --git a/telethon/update_state.py b/telethon/update_state.py index 314511d6..9239bd03 100644 --- a/telethon/update_state.py +++ b/telethon/update_state.py @@ -1,4 +1,5 @@ import logging +import threading from collections import deque from datetime import datetime from threading import RLock, Event, Thread @@ -41,6 +42,9 @@ class UpdateState: self._updates_available.wait() with self._updates_lock: + if not self._updates_available.is_set(): + return + update = self._updates.popleft() if not self._updates: self._updates_available.clear()