mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-11 03:56:36 +03:00
Ensure the worker threads have updates once they acquire the lock
This commit is contained in:
parent
9560bcc324
commit
72b7e99222
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue
Block a user