Fix
parent
175ff36bce
commit
0c52b2ad49
|
|
@ -60,15 +60,17 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
with conn:
|
with conn:
|
||||||
with conn.cursor() as cursor:
|
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()
|
rows = cursor.fetchall()
|
||||||
|
|
||||||
threads = []
|
threads = []
|
||||||
for row in rows:
|
for row in rows:
|
||||||
c = Camera(row[0], row[2]["rtsp_url"], row[1])
|
extends = row[2]
|
||||||
t = threading.Thread(target=c.healthbeat)
|
if isinstance(extends, dict) and extends["rtsp_url"] != '':
|
||||||
threads.append(t)
|
c = Camera(row[0], extends["rtsp_url"], row[1])
|
||||||
t.start()
|
t = threading.Thread(target=c.healthbeat)
|
||||||
|
threads.append(t)
|
||||||
|
t.start()
|
||||||
|
|
||||||
for t in threads:
|
for t in threads:
|
||||||
t.join()
|
t.join()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue