From 5c269bc662f4eb17f84ab710a58dbadb19674da2 Mon Sep 17 00:00:00 2001 From: Florent de Lamotte Date: Wed, 5 Mar 2025 20:03:43 +0100 Subject: [PATCH] timeout on waiting ack --- mccli.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mccli.py b/mccli.py index a6ba012..a93b507 100755 --- a/mccli.py +++ b/mccli.py @@ -516,9 +516,14 @@ class MeshCore: """ Wait for a message """ await self.rx_sem.acquire() - async def wait_ack(self): + async def wait_ack(self, timeout=10): """ Wait ack """ - await self.ack_ev.wait() + try: + await asyncio.wait_for(self.ack_ev.wait(), timeout) + return True + except TimeoutError : + printerr("Timeout waiting ack") + return False async def next_cmd(mc, cmds): """ process next command """