mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-08 17:13:56 +00:00
Safe close aiohttp session when delete bot instance
This commit is contained in:
parent
6a089fd19f
commit
e56be672a3
1 changed files with 6 additions and 0 deletions
|
|
@ -99,6 +99,12 @@ class BaseBot:
|
|||
|
||||
self.parse_mode = parse_mode
|
||||
|
||||
def __del__(self):
|
||||
if self.loop.is_running():
|
||||
self.loop.create_task(self.close())
|
||||
else:
|
||||
self.loop.run_until_complete(self.close())
|
||||
|
||||
@staticmethod
|
||||
def _prepare_timeout(
|
||||
value: typing.Optional[typing.Union[base.Integer, base.Float, aiohttp.ClientTimeout]]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue