Fixed cache shutdown to properly await task cancellation and added names to background tasks.
CI / Formatting (push) Successful in 5s
CI / Linting (push) Successful in 5s
CI / Tests (push) Successful in 22s
CI / Type Checking (push) Successful in 10s
CI / Spelling (push) Successful in 5s

This commit is contained in:
2026-03-22 20:17:06 -04:00
parent 23cc721612
commit c1f967ece9
3 changed files with 14 additions and 7 deletions
+5 -3
View File
@@ -179,7 +179,7 @@ class Crabstero(commands.Bot):
worker.cancel()
await asyncio.gather(*self._ingestion_workers, return_exceptions=True)
self._ingestion_workers.clear()
self.ingest_cache.stop()
await self.ingest_cache.stop()
if self._metrics_server is not None:
await self._metrics_server.stop()
if self._db is not None:
@@ -195,8 +195,10 @@ class Crabstero(commands.Bot):
def _start_ingestion_workers(self) -> None:
"""Spawn the fixed pool of ingestion worker tasks."""
for _ in range(self._ingestion_worker_count):
task = asyncio.create_task(self._ingestion_worker())
for i in range(self._ingestion_worker_count):
task = asyncio.create_task(
self._ingestion_worker(), name=f"ingestion-worker-{i}"
)
self._ingestion_workers.append(task)
async def _ingestion_worker(self) -> None: