feat: 停复机指令队列与设备维度判断
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled
自动停复机统一经停复机指令队列执行(全局开关 polling.stop_resume.queue_enabled,默认关闭): - 统一判断函数 decideCard,新旧路径共用;暂停轮询的卡在套餐到期、退款场景照常停机 - 同卡一条指令、版本号覆盖;领取校验单卡最小重试间隔;先于卡任务领取,不受 scheduler_mode 限制 - 执行器只调用一次网关,按错误分类退避与告警,结果未知在队列内确认 - 设备维度判断合并请求与场景,版本变化再判断,旧路径持设备锁时推后 - 套餐激活、重置、订单、流量扣减、套餐到期、退款、实名管控修改改为请求评估 - 监控增加停复机队列与近 1 小时执行计数,单卡轮询状态返回当前指令 - 迁移 000255 插入开关与告警、退避参数 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -145,6 +145,21 @@ type CardPollingTypeState struct {
|
||||
PendingConfirm []int `json:"pending_confirm" description:"待执行的延迟确认(秒)"`
|
||||
}
|
||||
|
||||
// CardStopResumeCommandState 卡当前停复机指令(停复机指令队列)。
|
||||
type CardStopResumeCommandState struct {
|
||||
Action string `json:"action" description:"动作 (stop:停机, start:复机)"`
|
||||
Reason string `json:"reason" description:"停机原因"`
|
||||
Scenes []string `json:"scenes" description:"触发场景"`
|
||||
Source string `json:"source" description:"请求来源"`
|
||||
Version int64 `json:"version" description:"指令版本"`
|
||||
FailCount int `json:"fail_count" description:"连续失败次数"`
|
||||
LastError string `json:"last_error" description:"最近错误(类别|信息)"`
|
||||
Pending bool `json:"pending" description:"结果未知,待确认"`
|
||||
Unknown int `json:"unknown" description:"连续结果未知次数"`
|
||||
WrittenAt *time.Time `json:"written_at" description:"最近写入时间"`
|
||||
NextAt *time.Time `json:"next_at" description:"下次可执行时间(空表示不在队列中)"`
|
||||
}
|
||||
|
||||
// CardPollingStateResponse 单卡轮询状态(只读)。
|
||||
type CardPollingStateResponse struct {
|
||||
CardID uint `json:"card_id" description:"卡ID"`
|
||||
@@ -158,6 +173,10 @@ type CardPollingStateResponse struct {
|
||||
ClaimExpireAt *time.Time `json:"claim_expire_at" description:"处理中标记到期时间"`
|
||||
PriorityMark bool `json:"priority_mark" description:"执行中收到请求检查,收尾后进入优先队列"`
|
||||
Types []CardPollingTypeState `json:"types" description:"各检查类型状态"`
|
||||
|
||||
StopResumeQueueEnabled bool `json:"stop_resume_queue_enabled" description:"停复机出口开关是否开启"`
|
||||
StopResumeCommand *CardStopResumeCommandState `json:"stop_resume_command" description:"当前停复机指令(无指令为空)"`
|
||||
LastStopResumeCallAt *time.Time `json:"last_stop_resume_call_at" description:"最近一次停复机网关调用时间(单卡最小重试间隔依据)"`
|
||||
}
|
||||
|
||||
// CarrierPollingStatsItem 按运营商账户的轮询监控。
|
||||
@@ -175,6 +194,15 @@ type CarrierPollingStatsItem struct {
|
||||
ExpiredClaims1h int64 `json:"expired_claims_1h" description:"近 1 小时处理中标记到期次数(执行崩溃或超时)"`
|
||||
OpenAlerts int64 `json:"open_alerts" description:"未处理卡级失败告警数"`
|
||||
OpenAlertsByType map[string]int64 `json:"open_alerts_by_category" description:"未处理卡级失败告警数(按错误类别)"`
|
||||
|
||||
StopResumeQueueLength int64 `json:"stop_resume_queue_length" description:"停复机指令队列长度"`
|
||||
StopResumeDue int64 `json:"stop_resume_due" description:"已到期停复机指令数"`
|
||||
StopResumeRunning int64 `json:"stop_resume_running" description:"执行中停复机指令数"`
|
||||
StopResumePending int64 `json:"stop_resume_pending" description:"结果未知待确认的停复机指令数(按队列前 500 条统计)"`
|
||||
StopResumeSuccess1h int64 `json:"stop_resume_success_1h" description:"近 1 小时停复机成功数"`
|
||||
StopResumeFailed1h int64 `json:"stop_resume_failed_1h" description:"近 1 小时停复机失败数(计入连续失败或终态)"`
|
||||
StopResumeRetry1h int64 `json:"stop_resume_retry_1h" description:"近 1 小时停复机推后重试数(限流、频率限制、最小间隔)"`
|
||||
StopResumeUnknown1h int64 `json:"stop_resume_unknown_1h" description:"近 1 小时停复机结果未知数"`
|
||||
}
|
||||
|
||||
// CarrierPollingStatsResponse 按运营商账户的轮询监控。
|
||||
|
||||
Reference in New Issue
Block a user