Runtime tasks: refresh last_run_at when alarm/inventory sync starts

Avoid stale last_run_at when sync_alarms_current runs longer than interval; clarifying tooltip on UME page.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-05-12 10:18:30 +08:00
parent ea7931496c
commit 61f6c99f93
2 changed files with 5 additions and 1 deletions

View file

@ -449,6 +449,7 @@ def on_startup() -> None:
_set_runtime_task(
"alarms_current_auto_sync",
status="running",
last_run_at=datetime.now(timezone.utc),
last_error="正在拉取 UME 当前告警…",
)
db = SessionLocal()
@ -491,6 +492,7 @@ def on_startup() -> None:
_set_runtime_task(
"inventory_auto_sync",
status="running",
last_run_at=datetime.now(timezone.utc),
last_error="正在拉取 UME 网元清单…",
)
db = SessionLocal()

View file

@ -296,7 +296,9 @@ export function UmePage({ toastOk, toastError }: UmePageProps) {
<th>task</th>
<th title="相邻两次循环 sleep 的配置间隔(与服务启动时 clamp 一致)">间隔</th>
<th>status</th>
<th>last_run_at</th>
<th title="每次周期开始时刷新;若单次同步耗时很长,间隔列仍为周期 sleep,实际两轮完成间隔 ≈ 同步耗时 + 间隔">
last_run_at
</th>
<th>last_error</th>
<th>操作</th>
</tr>