v1.2.22: 3rd audit fixes — UniqueViolation→409, lock_check no-db→False, escName add & escape
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user