From 6cc0a003be13f5fdf23e4a17502955025e9cf3c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Sun, 18 Feb 2024 00:44:26 +0100 Subject: [PATCH] added while loop and a 5 sec sleeper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- server/app.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/server/app.py b/server/app.py index d807951..e64b452 100644 --- a/server/app.py +++ b/server/app.py @@ -141,15 +141,17 @@ def mqtt_publisher(data_queue): sys.exit() def tube_index_updater(data_queue): - try: - cur = db.cursor() - cur.execute("SELECT mac_address, universe, dmx_address FROM tubes") - tube_index = cur.fetchall() - cur.close() - data_queue.put(tube_index) + while True: + try: + cur = db.cursor() + cur.execute("SELECT mac_address, universe, dmx_address FROM tubes") + tube_index = cur.fetchall() + cur.close() + data_queue.put(tube_index) - except Exception as e: - print(e) + except Exception as e: + print(e) + time.sleep(5) if __name__ == "__main__": data_queue = Queue()