From 74fa0640ff37ecd352f96ec17ef8885a15ccff9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Sat, 17 Feb 2024 23:15:02 +0100 Subject: [PATCH] added while loop to tube index updater MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- server/app.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/server/app.py b/server/app.py index 3bad79c..e1a1a0b 100644 --- a/server/app.py +++ b/server/app.py @@ -152,14 +152,15 @@ def mqtt_publisher(): sys.exit() def tube_index_updater(): - mqtt_client = connect_mqtt() - cur = db.cursor() - cur.execute("SELECT mac_address, universe, dmx_address FROM tubes") - TUBE_INDEX = cur.fetchall() - cur.close() - mqtt_client.publish("pxm/tube_index", str(TUBE_INDEX)) - print("Updated tube index") - time.sleep(1) + while True: + mqtt_client = connect_mqtt() + cur = db.cursor() + cur.execute("SELECT mac_address, universe, dmx_address FROM tubes") + TUBE_INDEX = cur.fetchall() + cur.close() + mqtt_client.publish("pxm/tube_index", str(TUBE_INDEX)) + print("Updated tube index") + time.sleep(5) if __name__ == "__main__":