From a1870de205e9777dc91f9d39f1f292a3be8dc952 Mon Sep 17 00:00:00 2001 From: TheTechromancer Date: Mon, 25 Dec 2023 18:55:22 -0500 Subject: [PATCH] clearer task creation for asyncio debugging --- bbot/modules/base.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bbot/modules/base.py b/bbot/modules/base.py index 6036c1463..01299c216 100644 --- a/bbot/modules/base.py +++ b/bbot/modules/base.py @@ -533,7 +533,8 @@ async def _setup(self): status = False self.debug(f"Setting up module {self.name}") try: - result = await self.setup() + setup_task = asyncio.create_task(self.setup()) + result = await setup_task if type(result) == tuple and len(result) == 2: status, msg = result else: @@ -600,7 +601,8 @@ async def _worker(self): if event.type == "FINISHED": context = f"{self.name}.finish()" async with self.scan._acatch(context), self._task_counter.count(context): - await self.finish() + finish_task = asyncio.create_task(self.finish()) + await finish_task else: context = f"{self.name}.handle_event({event})" self.scan.stats.event_consumed(event, self)