Open IOANNB4R opened 1 year ago
Hello. I always get the runtime warning when I stop my code. The on_startup function is called when the aiogram application starts
Run the following code
from aioredis import Redis from aiogram import Dispatcher from typing import Dict class Params: def __init__(self) -> None: self.redis = None async def get_redis(self) -> Redis: if not self.redis: self.redis = Redis(host='redis', password='redis_password') return self.redis async def get_params(self) -> Dict: redis = await self.get_redis() return await redis.get('PARAMS') async def close(self) -> None: if self.redis: await self.redis.close() params = Params() async def on_startup(dispatcher: Dispatcher) -> None: print(await params.get_params()) await params.close()
Stop the code
No runtime warning when the code stops because I manually close the redis connection
sys:1: RuntimeWarning: coroutine 'Connection.disconnect' was never awaited
Python 3.10.8
Version: 2.0.1
No response
Describe the bug
Hello. I always get the runtime warning when I stop my code. The on_startup function is called when the aiogram application starts
To Reproduce
Run the following code
Stop the code
Expected behavior
No runtime warning when the code stops because I manually close the redis connection
Logs/tracebacks
Python Version
aioredis Version
Additional context
No response
Code of Conduct