mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 17:36:34 +03:00
Don't raise inside __del__ (#1073)
This commit is contained in:
parent
f99b4874c8
commit
1544577757
|
@ -375,7 +375,13 @@ class TelegramBaseClient(abc.ABC):
|
|||
# able to close the pending tasks properly, and letting the script
|
||||
# complete without calling disconnect causes the script to trigger
|
||||
# 100% CPU load. Call disconnect to make sure it doesn't happen.
|
||||
self.disconnect()
|
||||
try:
|
||||
self.disconnect()
|
||||
except Exception:
|
||||
# Arguably not the best solution, but worth trying if the user
|
||||
# forgot to disconnect; normally this is fine but sometimes it
|
||||
# can fail (https://github.com/LonamiWebs/Telethon/issues/1073)
|
||||
pass
|
||||
|
||||
async def _switch_dc(self, new_dc):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user