mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-23 01:46:35 +03:00
Avoid receive busy wait when two threads receive items
This commit is contained in:
parent
ef509d13c7
commit
dd954b8fbd
|
@ -152,7 +152,12 @@ class MtProtoSender:
|
|||
Update and Updates objects.
|
||||
"""
|
||||
if self._recv_lock.locked():
|
||||
return
|
||||
with self._recv_lock:
|
||||
# Don't busy wait, acquire it but return because there's
|
||||
# already a receive running and we don't want another one.
|
||||
# It would lock until Telegram sent another update even if
|
||||
# the current receive already received the expected response.
|
||||
return
|
||||
|
||||
try:
|
||||
with self._recv_lock:
|
||||
|
|
Loading…
Reference in New Issue
Block a user