From fa92dee8193545100f2ba8e60eb2bc2503ca9e58 Mon Sep 17 00:00:00 2001 From: manatlan Date: Sat, 7 Oct 2023 15:14:06 +0200 Subject: [PATCH] Update appserver.py --- htagweb/appserver.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/htagweb/appserver.py b/htagweb/appserver.py index afe7c7c..34df175 100644 --- a/htagweb/appserver.py +++ b/htagweb/appserver.py @@ -139,13 +139,16 @@ async def loop_tag_update(self, event, websocket): with redys.v2.AClient() as bus: await bus.subscribe(event) - ok=True - while ok: - actions = await bus.get_event( event ) - if actions is not None: - ok=await self._sendback(websocket,json.dumps(actions)) - await asyncio.sleep(0.1) - + try: + ok=True + while ok: + actions = await bus.get_event( event ) + if actions is not None: + ok=await self._sendback(websocket,json.dumps(actions)) + await asyncio.sleep(0.1) + except: + print("**loop_tag_update, broken bus, will stop the loop_tag_update !**") + async def on_connect(self, websocket): #====================================================== get the event fqn=websocket.path_params.get("fqn","")