mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-05 06:01:02 +03:00
Fix sleep on the wrong indent and handle CancelledError
This was causing a huge slow-down every time a request was received delaying all the subsequent incoming messages too
This commit is contained in:
parent
374f5e2aab
commit
7641ba2d32
|
@ -350,6 +350,8 @@ class MTProtoSender:
|
|||
break
|
||||
except asyncio.TimeoutError:
|
||||
continue
|
||||
except asyncio.CancelledError:
|
||||
return
|
||||
except OSError as e:
|
||||
__log__.warning('OSError while sending %s', e)
|
||||
except:
|
||||
|
@ -385,6 +387,8 @@ class MTProtoSender:
|
|||
body = await self._connection.recv()
|
||||
except asyncio.TimeoutError:
|
||||
continue
|
||||
except asyncio.CancelledError:
|
||||
return
|
||||
except Exception as e:
|
||||
if isinstance(e, ConnectionError):
|
||||
__log__.info('Connection reset while receiving %s', e)
|
||||
|
@ -432,10 +436,12 @@ class MTProtoSender:
|
|||
else:
|
||||
try:
|
||||
await self._process_message(message)
|
||||
except asyncio.CancelledError:
|
||||
return
|
||||
except:
|
||||
__log__.exception('Unhandled exception while '
|
||||
'processing %s', message)
|
||||
await asyncio.sleep(1)
|
||||
await asyncio.sleep(1)
|
||||
|
||||
# Response Handlers
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user