v1.2.22: 3rd audit fixes — UniqueViolation→409, lock_check no-db→False, escName add & escape

This commit is contained in:
2026-07-31 18:20:33 +04:00
parent 06eb463088
commit 23688da90a
4 changed files with 7 additions and 3 deletions
+4
View File
@@ -74,6 +74,10 @@ def api_scenario_run():
conn.commit()
cur.close()
except Exception as e:
# Unique violation (23505) → другая параллельная вставка уже создала RUNNING
if hasattr(e, 'pgcode') and e.pgcode == '23505':
conn.rollback()
return jsonify({"error": "Another scenario is already running"}), 409
print(f"[API] create scenario_run error: {e}", flush=True)
conn.rollback()
return jsonify({"error": "Failed to create scenario_run"}), 500