feat(通道流量阈值): AUG26-011 运营商通道流量阈值达量停机与周期复机
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 12m59s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 12m59s
This commit is contained in:
45
internal/domain/carrierthreshold/command.go
Normal file
45
internal/domain/carrierthreshold/command.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package carrierthreshold
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/break/junhong_cmp_fiber/pkg/constants"
|
||||
)
|
||||
|
||||
// SubmissionQueryWindow 是停/复机子任务自提交起允许自动查询确认的窗口。
|
||||
//
|
||||
// 语义:子任务进入 submitted 后,恢复扫描只查询运营商状态回填;超过该窗口仍无法确认结果的
|
||||
// 锁会标记异常并转人工处理,不再每分钟重复查询同一笔无法收敛的结果,也不自动删除锁。
|
||||
const SubmissionQueryWindow = 30 * time.Minute
|
||||
|
||||
// SubmissionExpired 判断子任务自提交起是否已超过自动查询窗口。
|
||||
// 未提交(submittedAt 为空)不算超期。
|
||||
func SubmissionExpired(submittedAt *time.Time, now time.Time) bool {
|
||||
if submittedAt == nil {
|
||||
return false
|
||||
}
|
||||
return now.Sub(*submittedAt) >= SubmissionQueryWindow
|
||||
}
|
||||
|
||||
// CommandOutcome 是一次运营商停复机调用可安全记录的结果摘要。
|
||||
//
|
||||
// 它只承载回填可靠任务状态所需的事实:Integration Log 标识、结果分类与可安全展示的原因,
|
||||
// 不携带渠道报文原文、凭证或内部错误细节。
|
||||
type CommandOutcome struct {
|
||||
// IntegrationID 是本次 Gateway 调用的 Integration Log 标识,失败重试时取最后一次尝试。
|
||||
IntegrationID string
|
||||
// Result 取值 constants.AuditResultSuccess / AuditResultFailed / AuditResultUnknown。
|
||||
Result string
|
||||
// SafeReason 是可安全对外展示的失败原因,成功时为空。
|
||||
SafeReason string
|
||||
}
|
||||
|
||||
// Confirmed 判断本次运营商调用是否已明确成功。
|
||||
func (o CommandOutcome) Confirmed() bool {
|
||||
return o.Result == constants.AuditResultSuccess
|
||||
}
|
||||
|
||||
// Unresolved 判断本次运营商调用结果是否未知(必须由恢复扫描查询收敛)。
|
||||
func (o CommandOutcome) Unresolved() bool {
|
||||
return o.Result == constants.AuditResultUnknown
|
||||
}
|
||||
Reference in New Issue
Block a user