From 0c52b2ad49baec065ea744088445b303bfea38e9 Mon Sep 17 00:00:00 2001 From: Jing Li Date: Tue, 9 Apr 2024 20:26:16 +0800 Subject: [PATCH] Fix --- Healthbeat.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Healthbeat.py b/Healthbeat.py index 5004bca..4969141 100644 --- a/Healthbeat.py +++ b/Healthbeat.py @@ -60,15 +60,17 @@ if __name__ == '__main__': with conn: with conn.cursor() as cursor: - cursor.execute("SELECT id, status, extends FROM devices WHERE type = 1 AND status in (1, 2) AND supplier_key not in ('device-supplier-biang', 'device-supplier-yunfei') ORDER BY id ASC") + cursor.execute("SELECT id, status, extends FROM devices WHERE type = 1 AND status in (1, 2) ORDER BY id ASC") rows = cursor.fetchall() threads = [] for row in rows: - c = Camera(row[0], row[2]["rtsp_url"], row[1]) - t = threading.Thread(target=c.healthbeat) - threads.append(t) - t.start() + extends = row[2] + if isinstance(extends, dict) and extends["rtsp_url"] != '': + c = Camera(row[0], extends["rtsp_url"], row[1]) + t = threading.Thread(target=c.healthbeat) + threads.append(t) + t.start() for t in threads: t.join()