mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-16 19:41:07 +03:00
Fix end of sync with block warning on disconnect
This commit is contained in:
parent
54bffb30d8
commit
d02cb84abe
|
@ -1,5 +1,6 @@
|
|||
import getpass
|
||||
import hashlib
|
||||
import inspect
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
@ -469,7 +470,12 @@ class AuthMethods(MessageParseMethods, UserMethods):
|
|||
return await self.start()
|
||||
|
||||
def __exit__(self, *args):
|
||||
self.disconnect()
|
||||
if self._loop.is_running():
|
||||
self._loop.create_task(self.disconnect())
|
||||
elif inspect.iscoroutinefunction(self.disconnect):
|
||||
self._loop.run_until_complete(self.disconnect())
|
||||
else:
|
||||
self.disconnect()
|
||||
|
||||
async def __aexit__(self, *args):
|
||||
await self.disconnect()
|
||||
|
|
Loading…
Reference in New Issue
Block a user