mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-18 02:56:39 +00: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 getpass
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import inspect
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -469,7 +470,12 @@ class AuthMethods(MessageParseMethods, UserMethods):
|
|||||||
return await self.start()
|
return await self.start()
|
||||||
|
|
||||||
def __exit__(self, *args):
|
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):
|
async def __aexit__(self, *args):
|
||||||
await self.disconnect()
|
await self.disconnect()
|
||||||
|
Loading…
Reference in New Issue
Block a user