1
0
forked from M-Labs/kirdy

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

View File

@ -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