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