mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 19:00:46 +08:00
Fix UME topology sync stuck running and unique-key flush failures.
Use savepoint upserts with payload dedupe, finalize jobs on a fresh sibling session, serialize concurrent topology syncs, and reap stale running rows so the scheduler does not keep spawning orphans. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
fe483f51cc
commit
4fcec36514
9 changed files with 565 additions and 169 deletions
|
|
@ -66,17 +66,33 @@ def ume_sync(payload: dict[str, Any] | None = None, db: Session = Depends(get_db
|
|||
}
|
||||
)
|
||||
if "topology" in domain_set:
|
||||
job = sync_topology_full(db, client, trigger_mode=trigger_mode)
|
||||
out["jobs"].append(
|
||||
{
|
||||
"domain": "topology",
|
||||
"status": job.status,
|
||||
"pulled_count": int(job.pulled_count or 0),
|
||||
"inserted_count": int(job.inserted_count or 0),
|
||||
"updated_count": int(job.updated_count or 0),
|
||||
"error_message": str(job.error_message or ""),
|
||||
}
|
||||
)
|
||||
try:
|
||||
job = sync_topology_full(db, client, trigger_mode=trigger_mode)
|
||||
out["jobs"].append(
|
||||
{
|
||||
"domain": "topology",
|
||||
"status": job.status,
|
||||
"pulled_count": int(job.pulled_count or 0),
|
||||
"inserted_count": int(job.inserted_count or 0),
|
||||
"updated_count": int(job.updated_count or 0),
|
||||
"error_message": str(job.error_message or ""),
|
||||
}
|
||||
)
|
||||
except RuntimeError as exc:
|
||||
msg = str(exc)
|
||||
if msg.startswith("topology_sync_busy"):
|
||||
out["jobs"].append(
|
||||
{
|
||||
"domain": "topology",
|
||||
"status": "skipped",
|
||||
"pulled_count": 0,
|
||||
"inserted_count": 0,
|
||||
"updated_count": 0,
|
||||
"error_message": msg[:240],
|
||||
}
|
||||
)
|
||||
else:
|
||||
raise
|
||||
if "alarms" in domain_set or "alarms_current" in domain_set:
|
||||
paused_ws_for_sync = False
|
||||
if is_wss_active_for_current_alarms() and trigger_mode == "manual":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue