feat(app): use simpler syntax for enqueue_batch threaded execution

This commit is contained in:
psychedelicious
2025-03-03 13:02:55 +10:00
parent c8aaf5e76b
commit 7399909029

View File

@@ -103,8 +103,7 @@ class SqliteSessionQueue(SessionQueueBase):
return cast(Union[int, None], self.__cursor.fetchone()[0]) or 0
async def enqueue_batch(self, queue_id: str, batch: Batch, prepend: bool) -> EnqueueBatchResult:
loop = asyncio.get_event_loop()
return await loop.run_in_executor(None, self._enqueue_batch, queue_id, batch, prepend)
return await asyncio.to_thread(self._enqueue_batch, queue_id, batch, prepend)
def _enqueue_batch(self, queue_id: str, batch: Batch, prepend: bool) -> EnqueueBatchResult:
try: