From e8d3858fc94810d9c13b35ee29103cddf40833b7 Mon Sep 17 00:00:00 2001 From: linuswck Date: Thu, 10 Oct 2024 15:20:58 +0800 Subject: [PATCH] driver: return whether task queue is full in task_dispatcher() --- pykirdy/driver/kirdy.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pykirdy/driver/kirdy.py b/pykirdy/driver/kirdy.py index 48df3d1..cb7d653 100644 --- a/pykirdy/driver/kirdy.py +++ b/pykirdy/driver/kirdy.py @@ -759,7 +759,11 @@ class Kirdy: Enqueue a task to be handled by the handler. """ if self.connected(): - self._task_queue.put_nowait(lambda: awaitable_fn) + try: + self._task_queue.put_nowait(lambda: awaitable_fn) + return True + except asyncio.queues.QueueFull: + return False else: raise ConnectionError