From 08d72f44932f7fecdf4b7102709933d87d06d82a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Sat, 17 Feb 2024 04:12:22 +0100 Subject: [PATCH] tube index update time at 10 sec and start first. also removed sql request from publisher MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- server/app.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/server/app.py b/server/app.py index dee1b09..a760495 100644 --- a/server/app.py +++ b/server/app.py @@ -114,11 +114,6 @@ def start_mqtt_publishers(): mqtt_client = connect_mqtt() artnetBindIp = get_eth0_ip() artNet = Artnet.Artnet(BINDIP = artnetBindIp, DEBUG = True, SHORTNAME = "PiXelTubeMaster", LONGNAME = "PiXelTubeMaster", PORT = 6454) - cur = db.cursor() - cur.execute("SELECT mac_address, universe, dmx_address FROM tubes") - global result - result = cur.fetchall() - cur.close() while True: try: # Gets whatever the last Art-Net packet we received is @@ -178,17 +173,17 @@ def start_mqtt_publishers(): def update_tube_index(): while True: - time.sleep(2) cur = db.cursor() cur.execute("SELECT mac_address, universe, dmx_address FROM tubes") global result result = cur.fetchall() cur.close() + time.sleep(10) if __name__ == "__main__": + tube_index_updater_thread = Process(target=update_tube_index) + tube_index_updater_thread.start() flask_thread = Process(target=flask_api) flask_thread.start() publisher_thread = Process(target=start_mqtt_publishers) publisher_thread.start() - tube_index_updater_thread = Process(target=update_tube_index) - tube_index_updater_thread.start()