feat: 加固运行期可靠性并补齐调度与观测接口
- 运行句柄按 run_id 归属,修复取消后重跑时闸门被旧运行删除的竞态 - 调度循环改用取消令牌退出,启动时对账遗留运行,校验 rows_affected - 三类任务统一参与调度,新增 /api/v1/stats 与 /api/v1/schedule - SQLite 启用 WAL 与 busy_timeout,日志清理跳过活跃文件,单行上限 256 KiB - 前端缓存管理令牌并在 403 时重试一次,仪表盘改用统计接口
This commit is contained in:
@@ -317,6 +317,29 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/schedule": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"tasks"
|
||||
],
|
||||
"operationId": "list_schedule",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Next trigger time per enabled task",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/ScheduledTaskResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/session": {
|
||||
"get": {
|
||||
"tags": [
|
||||
@@ -337,6 +360,26 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/stats": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"tasks"
|
||||
],
|
||||
"operationId": "task_stats",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Dashboard counters",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TaskStatsResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/system/directories": {
|
||||
"get": {
|
||||
"tags": [
|
||||
@@ -1088,6 +1131,26 @@
|
||||
"retry"
|
||||
]
|
||||
},
|
||||
"ScheduledTaskResponse": {
|
||||
"type": "object",
|
||||
"description": "已注册调度的任务及其下次触发时间。",
|
||||
"required": [
|
||||
"task_id"
|
||||
],
|
||||
"properties": {
|
||||
"next_run_at": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"format": "date-time",
|
||||
"description": "下次触发时间;调度正在重建时可能为空"
|
||||
},
|
||||
"task_id": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"SessionResponse": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
@@ -1426,6 +1489,56 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"TaskStatsResponse": {
|
||||
"type": "object",
|
||||
"description": "仪表盘指标:一次请求拿到全部计数,避免为每个指标各发一次列表查询。",
|
||||
"required": [
|
||||
"total",
|
||||
"enabled",
|
||||
"running",
|
||||
"script",
|
||||
"http",
|
||||
"process"
|
||||
],
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "已启用任务数",
|
||||
"minimum": 0
|
||||
},
|
||||
"http": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "HTTP 类任务数",
|
||||
"minimum": 0
|
||||
},
|
||||
"process": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "进程类任务数",
|
||||
"minimum": 0
|
||||
},
|
||||
"running": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "当前正在执行的任务数",
|
||||
"minimum": 0
|
||||
},
|
||||
"script": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "脚本类任务数",
|
||||
"minimum": 0
|
||||
},
|
||||
"total": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "任务总数",
|
||||
"minimum": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"UpdateTaskRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
||||
Reference in New Issue
Block a user