python - 我收到此错误:任务已销毁但未决
问题描述
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)
我Task was destroyed but it is pending!
在使用时遇到此错误await init_redis_conn()
,我在 Python 3.8 中使用 aioredis=1.3.1。请帮帮我谢谢
解决方案
推荐阅读
- c - 如何将 char 指针值分配给整数/char 变量或数组
- javascript - json stringify writeStream完成后如何解决promise?
- gitlab - Gitlab 每个环境单独的容器注册表
- skia - 如何编译skia中包含的HelloWorld应用程序?
- javascript - 从单元格获取值(多个电子邮件地址)时出错
- scala - 以 Map 作为输入的 Spark UDF
- jhipster - JHipster 从 6.1.2 升级到 6.2.0 的问题
- jquery - 无法在 ajax 调用中更改 a.text()
- c# - Firebase 保存数据的速度会随着时间的推移而变慢
- python - 我需要高效的 Django ORM 代码来减少查询命中