From d55589790a04be3e17eae262fa255f50881870ef Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Wed, 5 May 2021 22:07:37 -0700 Subject: [PATCH] this error should be asyncio.TimeoutError, make retries faster... Turns out that the base TimeoutError is different than the asyncio version, and so we weren't actually retrying packets, just terminating early... --- lora.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lora.py b/lora.py index c4f1baf..9dca579 100644 --- a/lora.py +++ b/lora.py @@ -77,7 +77,7 @@ class LORANode(object): origstate = self.st.copy() while True: - resp = await self.sd.sendtillrecv(msg, 1) + resp = await self.sd.sendtillrecv(msg, .25) #_debprint('got:', resp) # skip empty messages @@ -133,7 +133,7 @@ class SyncDatagram(object): async def recv(self, timeout=None): #pragma: no cover '''Receive a datagram. If timeout is not None, wait that many seconds, and if nothing is received in that time, raise an - TimeoutError exception.''' + asyncio.TimeoutError exception.''' raise NotImplementedError @@ -151,7 +151,7 @@ class SyncDatagram(object): await self.send(data) try: return await self.recv(freq) - except TimeoutError: + except asyncio.TimeoutError: pass class MulticastSyncDatagram(SyncDatagram): @@ -340,7 +340,7 @@ class TestSyncData(unittest.IsolatedAsyncioTestCase): class MySync(SyncDatagram): def __init__(self): self.sendq = [] - self.resp = [ TimeoutError(), b'a' ] + self.resp = [ asyncio.TimeoutError(), b'a' ] async def recv(self, timeout=None): assert timeout == 1