mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-09 09:22:03 +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
|
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
|
@staticmethod
|
||||||
def _prepare_timeout(
|
def _prepare_timeout(
|
||||||
value: typing.Optional[typing.Union[base.Integer, base.Float, aiohttp.ClientTimeout]]
|
value: typing.Optional[typing.Union[base.Integer, base.Float, aiohttp.ClientTimeout]]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue