feat: 停复机指令队列与设备维度判断
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:
邹进
2026-10-26 00:36:26 +09:00
parent 1369fed642
commit 934a3a27a1
31 changed files with 2275 additions and 117 deletions

View File

@@ -0,0 +1,4 @@
-- 回滚停复机指令队列的受控系统配置。
DELETE FROM tb_system_config WHERE config_key IN (
'polling.stop_resume.queue_enabled', 'polling.stop_resume.unknown_alert_threshold',
'polling.stop_resume.backoff_seconds', 'polling.stop_resume.alert_fail_count');

View File

@@ -0,0 +1,16 @@
-- 停复机指令队列的受控系统配置(add-stop-resume-command-queue),module = polling。
-- 配置的权威定义(类型、取值范围、默认值、JSON 结构校验)在代码注册表中;本迁移只落库初始值。
-- 已存在同名 Key 时不覆盖(ON CONFLICT DO NOTHING)。
--
-- 1. polling.stop_resume.queue_enabled:自动停复机经停复机指令队列执行的全局开关,默认关闭;关闭即各入口当场执行(回退)。
-- 2. polling.stop_resume.unknown_alert_threshold:停复机连续结果未知达到该次数时写失败告警,指令不丢弃。
-- 3. polling.stop_resume.backoff_seconds:停复机失败退避序列(秒,递增),超过序列长度按最后一项重试。
-- 4. polling.stop_resume.alert_fail_count:停复机连续失败告警阈值。
-- 账户级停复机参数(执行上限、max_in_flight、单卡最小重试间隔、确认延迟)已在 tb_carrier_polling_param 建列(000251)。
INSERT INTO tb_system_config (config_key, config_value, value_type, module, description, is_readonly, is_sensitive, creator, updater, created_at, updated_at) VALUES
('polling.stop_resume.queue_enabled', 'false', 'bool', 'polling', '自动停复机经停复机指令队列执行(全局开关,关闭即各入口当场执行)', FALSE, FALSE, 0, 0, NOW(), NOW()),
('polling.stop_resume.unknown_alert_threshold', '3', 'int', 'polling', '停复机连续结果未知告警阈值', FALSE, FALSE, 0, 0, NOW(), NOW()),
('polling.stop_resume.backoff_seconds', '[600,900,1800,3600]', 'json', 'polling', '停复机失败退避序列(秒,递增)', FALSE, FALSE, 0, 0, NOW(), NOW()),
('polling.stop_resume.alert_fail_count', '5', 'int', 'polling', '停复机连续失败告警阈值', FALSE, FALSE, 0, 0, NOW(), NOW())
ON CONFLICT (config_key) DO NOTHING;