feat: 下线设备保护期
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m30s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m30s
- 后台设备停复机不再设置 1 小时保护期,也不再因保护期拒绝相反操作;单卡手动停复机去掉保护期检查 - 删除保护期一致性轮询(polling:protect)及其强制停复机方法;调度、初始化、监控、匹配预览不再包含保护期;已入队的旧任务由空处理函数直接确认,下一次发布移除 - 轮询配置接口不再接受与返回 protect_check_interval;并发配置不再返回 protect,查询、更新、重置该类型时拒绝 - 资产详情 device_protect_status 固定返回 none 并标记废弃,兼容老版本客户端 - 删除保护期 Redis key 与时长常量;停机原因 protect_period 保留供历史数据与开放接口映射 - 迁移 000249 只把 protect_check_interval、last_protect_check_at 列注释标记为已废弃,不删列不改数据
This commit is contained in:
@@ -200,7 +200,7 @@ func (m *PollingConfigManager) lazyTierFacts(card *model.IotCard) func() TierFac
|
||||
// hasAnyConfiguredInterval 检查配置是否至少配置了一种检查间隔(正数或 0)。
|
||||
func hasAnyConfiguredInterval(cfg *model.PollingConfig) bool {
|
||||
return cfg.RealnameCheckInterval != nil || cfg.CarddataCheckInterval != nil || cfg.PackageCheckInterval != nil ||
|
||||
(cfg.ProtectCheckInterval != nil && *cfg.ProtectCheckInterval > 0) || cfg.CardStatusCheckInterval != nil
|
||||
cfg.CardStatusCheckInterval != nil
|
||||
}
|
||||
|
||||
// IntervalSource 是某检查类型最终采用的间隔及其来源,供合并结果与匹配预览共用。
|
||||
@@ -213,15 +213,11 @@ type IntervalSource struct {
|
||||
Config *model.PollingConfig
|
||||
}
|
||||
|
||||
// taskIntervalFields 返回配置中各检查类型的间隔字段(保护期按既有语义只认正数)。
|
||||
// taskIntervalFields 返回配置中各检查类型的间隔字段。
|
||||
func taskIntervalFields(cfg *model.PollingConfig) []struct {
|
||||
taskType string
|
||||
value *int
|
||||
} {
|
||||
protect := cfg.ProtectCheckInterval
|
||||
if protect != nil && *protect <= 0 {
|
||||
protect = nil
|
||||
}
|
||||
return []struct {
|
||||
taskType string
|
||||
value *int
|
||||
@@ -229,7 +225,6 @@ func taskIntervalFields(cfg *model.PollingConfig) []struct {
|
||||
{constants.TaskTypePollingRealname, cfg.RealnameCheckInterval},
|
||||
{constants.TaskTypePollingCarddata, cfg.CarddataCheckInterval},
|
||||
{constants.TaskTypePollingPackage, cfg.PackageCheckInterval},
|
||||
{constants.TaskTypePollingProtect, protect},
|
||||
{constants.TaskTypePollingCardStatus, cfg.CardStatusCheckInterval},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,8 +327,6 @@ func lastCheckAtByTaskType(card *model.IotCard, taskType string) *time.Time {
|
||||
return card.LastRealNameCheckAt
|
||||
case constants.TaskTypePollingCarddata, constants.TaskTypePollingPackage:
|
||||
return card.LastDataCheckAt
|
||||
case constants.TaskTypePollingProtect:
|
||||
return card.LastProtectCheckAt
|
||||
case constants.TaskTypePollingCardStatus:
|
||||
return card.LastCardStatusCheckAt
|
||||
default:
|
||||
|
||||
@@ -17,7 +17,6 @@ var allTaskTypes = []string{
|
||||
constants.TaskTypePollingRealname,
|
||||
constants.TaskTypePollingCarddata,
|
||||
constants.TaskTypePollingPackage,
|
||||
constants.TaskTypePollingProtect,
|
||||
constants.TaskTypePollingCardStatus,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user