2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-02-19 22:24:26 +00:00

Make it easier to debug slow callback

Provide a name to create_task to make the
slow callback warning actually usable.
This commit is contained in:
Jarrod Johnson
2024-08-08 16:25:04 -04:00
parent d7d89dd233
commit 42e5a556c1

View File

@@ -64,9 +64,9 @@ def spawn(coro):
tskid = random.random()
tsks[tskid] = 1
try:
tsks[tskid] = asyncio.create_task(_run(coro, tskid))
tsks[tskid] = asyncio.create_task(_run(coro, tskid), name=repr(coro))
except AttributeError:
tsks[tskid] = asyncio.get_event_loop().create_task(_run(coro, tskid))
tsks[tskid] = asyncio.get_event_loop().create_task(_run(coro, tskid), name=repr(coro))
return tsks[tskid]
async def _run(coro, taskid):