mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-17 03:51:05 +03:00
Await updates task to finish upon disconnect
This commit is contained in:
parent
6ab8571168
commit
044e6e8a85
|
@ -292,6 +292,9 @@ class TelegramBaseClient(abc.ABC):
|
|||
Disconnects from Telegram.
|
||||
"""
|
||||
await self._sender.disconnect()
|
||||
if self._updates_handle:
|
||||
await self._updates_handle
|
||||
|
||||
self.session.close()
|
||||
|
||||
async def _switch_dc(self, new_dc):
|
||||
|
@ -410,11 +413,10 @@ class TelegramBaseClient(abc.ABC):
|
|||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
# Let people use client.invoke(SomeRequest()) instead client(...)
|
||||
async def invoke(self, *args, **kwargs):
|
||||
warnings.warn('client.invoke(...) is deprecated, '
|
||||
'use client(...) instead')
|
||||
return await self(*args, **kwargs)
|
||||
self(*args, **kwargs)
|
||||
|
||||
@abc.abstractmethod
|
||||
def _handle_update(self, update):
|
||||
|
|
Loading…
Reference in New Issue
Block a user