changeset 1:087b57dd3587 default tip

if dimcurve request times out, abort so we get its new address
author drewp@bigasterisk.com
date Sat, 14 Dec 2024 21:39:44 -0800
parents 62cca1da7955
children
files sensor_bridge.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/sensor_bridge.py	Sat Dec 14 17:46:42 2024 -0800
+++ b/sensor_bridge.py	Sat Dec 14 21:39:44 2024 -0800
@@ -19,7 +19,11 @@
 
 
 async def sendValue(faderName: str, value: float):
-    await httpClient.put(faderValueUrl(faderName), content=str(value).encode('ascii'))
+    try:
+        await httpClient.put(faderValueUrl(faderName), content=str(value).encode('ascii'), timeout=2)
+    except Exception:
+        log.warning("put failed - restarting service", exc_info=True)
+        os.abort()
 
 
 async def onMessage(message):