From 42e5a556c17f6188e3fc080ccf25af8a49164ea8 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 8 Aug 2024 16:25:04 -0400 Subject: [PATCH] Make it easier to debug slow callback Provide a name to create_task to make the slow callback warning actually usable. --- confluent_server/confluent/util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/confluent_server/confluent/util.py b/confluent_server/confluent/util.py index 041d7460..b78fe13d 100644 --- a/confluent_server/confluent/util.py +++ b/confluent_server/confluent/util.py @@ -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):