Make it more stable

Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
fly 2021-01-13 20:43:17 +00:00
parent bc4eb9e7b9
commit cc6f79b2ff

View file

@ -96,6 +96,8 @@ def set_state(name, status):
sid = cursor.fetchone() sid = cursor.fetchone()
sql = "UPDATE tile SET status_id = " + str(sid[0]) + " WHERE parent_id = " + str(pid[0]) sql = "UPDATE tile SET status_id = " + str(sid[0]) + " WHERE parent_id = " + str(pid[0])
cursor.execute(sql) cursor.execute(sql)
sql = "UPDATE secondLevel SET status_id = " + str(sid[0]) + " WHERE name = '" + name + "'"
cursor.execute(sql)
else: else:
sql = "UPDATE tile SET status_id = (SELECT id FROM status WHERE name = '" + status + "') WHERE id = " + name sql = "UPDATE tile SET status_id = (SELECT id FROM status WHERE name = '" + status + "') WHERE id = " + name
cursor.execute(sql) cursor.execute(sql)
@ -114,6 +116,7 @@ try:
msg = msg.decode() msg = msg.decode()
db.ping(reconnect=True) db.ping(reconnect=True)
db.commit()
match = re.match(r"(set) ([ew]\d{3}[ns]\d{2}|[0-9]{1,7}) (done|started|rebuild|skip|pending|packaged)", msg) match = re.match(r"(set) ([ew]\d{3}[ns]\d{2}|[0-9]{1,7}) (done|started|rebuild|skip|pending|packaged)", msg)
if match != None: if match != None: