Heartbeat 健康巡检
Heartbeat 是 Gateway 为单个 Profile 运行的轻量健康循环。它定期记录健康状态,目前会检查已启用 Cron Job 的上一次运行是否失败。
它不是隐藏的 Cron Job,不会出现在 Cron 列表,也不会每次 Tick 都调用模型。
默认行为
| 设置 | 默认值 |
|---|---|
| Enabled | 是 |
| Tick Interval | 1 分钟 |
| Failure Cooldown | 15 分钟 |
| Delivery Target | Gateway Event Bus |
| Role / Workspace | Profile 默认值 |
正常 Tick 只记录状态,不发送消息。发现新的 Cron 失败签名时会发出一次通知;同一个没有变化的失败不会无限重复提醒。
查看状态
anyy heartbeat status
anyy heartbeat status --json
结果包括 Enabled、当前 Status、Interval、Cooldown、Role、Workspace、Delivery Targets、失败 Cron 数量和最后 Tick 时间。
综合状态里也能看到 Heartbeat:
anyy status
anyy doctor
配置 Heartbeat
配置属于各自 Profile,放在 heartbeat 区块:
heartbeat:
enabled: true
tick_interval: 1m
failure_cooldown: 15m
delivery_targets:
- gateway
role_id: default
workspace_id: default
当前没有 heartbeat set 或手动 heartbeat tick 命令。高级手改前先备份 Profile,之后用 anyy doctor 校验;运行时不能 Reload 时再重启 Gateway。
修复 Cron,而不是处理通知本身
Heartbeat 只报告上一次运行失败,不负责重试或修复。进入 Dashboard → Cron 查看历史,处理原因后手动运行或等待下一次调度。
通知送到哪里
默认目标是 Gateway Event Bus,因此连接中的 Anyy 界面可以看到通知。是否投递到特定渠道取决于渠道 Adapter 与当前路由;Heartbeat 不会自动广播到全部渠道。
常见问题
| 现象 | 检查项 |
|---|---|
Status 一直是 unknown | 确认 Gateway 运行,并等待超过一个 Tick Interval |
| Heartbeat 意外关闭 | 检查当前 Profile,而不是另一个 Profile 的配置 |
| 同一失败看似重复 | 确认 Cron 的 Last-run Signature 是否因新一次执行而变化 |
| 通知指出某个 Job 失败 | 查看该 Cron Job 的状态和历史,Heartbeat 只是探测器 |
heartbeat tick 被拒绝 | 当前公开 CLI 只有 heartbeat status |