driver: return whether task queue is full in task_dispatcher()

This commit is contained in:
linuswck 2024-10-10 15:20:58 +08:00
parent 9bec56ed6c
commit e8d3858fc9
1 changed files with 5 additions and 1 deletions

View File

@ -759,7 +759,11 @@ class Kirdy:
Enqueue a task to be handled by the handler. Enqueue a task to be handled by the handler.
""" """
if self.connected(): 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: else:
raise ConnectionError raise ConnectionError