From 395f3880a272a1fb7195edec25e6c28d5e505846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Sat, 17 Feb 2024 16:25:47 +0100 Subject: [PATCH] moved updater odwn MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- server/app.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/server/app.py b/server/app.py index c422c33..d86a24d 100644 --- a/server/app.py +++ b/server/app.py @@ -114,16 +114,6 @@ def connect_mqtt(): client.connect("localhost", 1883) return client -def update_tube_index(): - while True: - cur = db.cursor() - cur.execute("SELECT mac_address, universe, dmx_address FROM tubes") - global TUBE_INDEX - TUBE_INDEX = cur.fetchall() - cur.close() - print("Updated index: "+str(TUBE_INDEX)) - time.sleep(1) - def mqtt_publisher(): global TUBE_INDEX # Create and start a thread for each universe @@ -156,6 +146,16 @@ def mqtt_publisher(): artNet.close() sys.exit() +def update_tube_index(): + while True: + cur = db.cursor() + cur.execute("SELECT mac_address, universe, dmx_address FROM tubes") + global TUBE_INDEX + TUBE_INDEX = cur.fetchall() + cur.close() + print("Updated index: "+str(TUBE_INDEX)) + time.sleep(1) + if __name__ == "__main__": tube_index_updater_thread = Process(target=update_tube_index) tube_index_updater_thread.start()