mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-03 05:04:33 +03:00
Reduce indent level to simplify flow on __call__
This commit is contained in:
parent
778c844a64
commit
959e824c1c
|
@ -423,21 +423,21 @@ class TelegramBareClient:
|
|||
result = self._invoke(
|
||||
sender, call_receive, update_state, *requests
|
||||
)
|
||||
if result is None:
|
||||
sleep(1)
|
||||
self._logger.debug('RPC failed. Attempting reconnection.')
|
||||
# The ReadThread has priority when attempting reconnection,
|
||||
# since this thread is constantly running while __call__ is
|
||||
# only done sometimes. Here try connecting only once/retry.
|
||||
if sender == self._sender:
|
||||
if not self._reconnect_lock.locked():
|
||||
with self._reconnect_lock:
|
||||
self._reconnect()
|
||||
else:
|
||||
sender.connect()
|
||||
else:
|
||||
if result is not None:
|
||||
return result
|
||||
|
||||
self._logger.debug('RPC failed. Attempting reconnection.')
|
||||
sleep(1)
|
||||
# The ReadThread has priority when attempting reconnection,
|
||||
# since this thread is constantly running while __call__ is
|
||||
# only done sometimes. Here try connecting only once/retry.
|
||||
if sender == self._sender:
|
||||
if not self._reconnect_lock.locked():
|
||||
with self._reconnect_lock:
|
||||
self._reconnect()
|
||||
else:
|
||||
sender.connect()
|
||||
|
||||
raise ValueError('Number of retries reached 0.')
|
||||
finally:
|
||||
if sender != self._sender:
|
||||
|
|
Loading…
Reference in New Issue
Block a user