I am getting this error: Task was destroyed but it is pending

508 views Asked by At
from aioredis import (
    create_redis_pool
)

class RedisConn:
    def __init__(self):
        self.conn = None

    def set_conn(self, c):
        self.conn = c

    def get_conn(self):
        return self.conn


rdpsc = RedisConn()


async def init_redis_conn():
    connection = None
    try:
        connection = await create_redis_pool(
            'redis://localhost:6379',
            db=1
        )
        rdpsc.set_conn(connection)
    except Exception as excep:
        sentry_sdk.capture_exception(excep)

I am getting this error Task was destroyed but it is pending! while using await init_redis_conn(), I am using aioredis=1.3.1 with Python 3.8. Please help me thanks

0

There are 0 answers