aio-libs / janus

Thread-safe asyncio-aware queue for Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Task was destroyed but it is pending

earonesty opened this issue · comments

I get flooded with these when using janus

2023-10-25 17:32:45,185 - asyncio - ERROR - Task was destroyed but it is pending!
task: <Task pending name='Task-8498' coro=<Queue._notify_async_not_empty..f() running at /home/ubuntu/ai-worker/venv/lib/python3.11/site-packages/janus/init.py:238> cb=[set.discard()]>

The queue is probably destroyed without properly closing it. You can try this:

q.close()
await q.wait_closed()