From 2f1d5670349e18a300884a2a4ba983c85755754e Mon Sep 17 00:00:00 2001 From: Nicolas Rabault Date: Tue, 6 Sep 2022 15:15:49 +0200 Subject: [PATCH 1/4] [telemetry] manage request error --- pyluos/device.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyluos/device.py b/pyluos/device.py index a548c76..379eccc 100644 --- a/pyluos/device.py +++ b/pyluos/device.py @@ -210,8 +210,10 @@ def _setup(self): "pyluos_rev": version, "routing_table":state['routing_table']} try: - requests.post("https://monorepo-services.vercel.app/api/telemetry", + r = requests.post("https://monorepo-services.vercel.app/api/telemetry", data=luos_telemetry) + if not r: + print("Telemetry request failed : error " + str(r.status_code)) except: print("Telemetry request failed.") else: From ccca2496652ad54ffff75194ac9380b81963bcc4 Mon Sep 17 00:00:00 2001 From: JeromeGalan Date: Wed, 7 Sep 2022 09:21:32 +0200 Subject: [PATCH 2/4] Update Pyluos version to 2.2.5 --- pyluos/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyluos/version.py b/pyluos/version.py index 48f45a2..9bb8918 100644 --- a/pyluos/version.py +++ b/pyluos/version.py @@ -1 +1 @@ -version = '2.2.4' +version = '2.2.5' From 5dbb9583c92e73711bc99d87ca78435eb89c5d27 Mon Sep 17 00:00:00 2001 From: JeromeGalan Date: Fri, 7 Oct 2022 17:07:25 +0200 Subject: [PATCH 3/4] Ignore void messages --- pyluos/io/serial_io.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pyluos/io/serial_io.py b/pyluos/io/serial_io.py index e1478f6..1042db2 100644 --- a/pyluos/io/serial_io.py +++ b/pyluos/io/serial_io.py @@ -112,7 +112,13 @@ def extract_line(s): return extract_line(s[H+1:]) else: # Footer is ok - return s[data_start:data_end], s[data_end + 1:] + data = s[data_start:data_end] + if data == b'{}\n': + # Datas are void + return b'', s[data_end + 1:] + else: + # Datas are not void + return data, s[data_end + 1:] period = 1 / self.poll_frequency buff = b'' From d8131e370316fec50d7c0aee9a62e4cb3f812067 Mon Sep 17 00:00:00 2001 From: JeromeGalan Date: Mon, 10 Oct 2022 17:38:45 +0200 Subject: [PATCH 4/4] Increase queue length to handle more messages --- pyluos/io/serial_io.py | 2 +- pyluos/io/ws.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyluos/io/serial_io.py b/pyluos/io/serial_io.py index 1042db2..c289372 100644 --- a/pyluos/io/serial_io.py +++ b/pyluos/io/serial_io.py @@ -44,7 +44,7 @@ def __init__(self, host, baudrate=None): self._serial = _serial.Serial(host, baudrate) self._serial.flush() - self._msg = queue.Queue(100) + self._msg = queue.Queue(500) self._running = True self._poll_loop = Thread(target=self._poll) diff --git a/pyluos/io/ws.py b/pyluos/io/ws.py index 85cb8a9..110e5f5 100644 --- a/pyluos/io/ws.py +++ b/pyluos/io/ws.py @@ -50,7 +50,7 @@ def __init__(self, host, port=9342): self._ws = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self._ws.connect((host, port)) - self._msg = queue.Queue(100) + self._msg = queue.Queue(500) self._running = True self._poll_loop = Thread(target=self._poll)