mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 12:59:46 +00:00
Revert disconnect() to be async again (#1133)
It's the only way to properly clean all background tasks, which the library makes heavy use for in MTProto/Connection send and receive loops. Some parts of the code even relied on the fact that it was asynchronous (it used to return a future so you could await it and not be breaking). It's automatically syncified to reduce the damage of being a breaking change.
This commit is contained in:
@@ -16,7 +16,7 @@ class UpdateMethods(UserMethods):
|
||||
try:
|
||||
await self.disconnected
|
||||
except KeyboardInterrupt:
|
||||
self.disconnect()
|
||||
await self.disconnect()
|
||||
|
||||
def run_until_disconnected(self):
|
||||
"""
|
||||
@@ -33,7 +33,7 @@ class UpdateMethods(UserMethods):
|
||||
try:
|
||||
return self.loop.run_until_complete(self.disconnected)
|
||||
except KeyboardInterrupt:
|
||||
self.disconnect()
|
||||
self.loop.run_until_complete(self.disconnect())
|
||||
|
||||
def on(self, event):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user