fix: 修复停复机操作未同步轮询卡缓存导致卡无法实际停机的问题
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled
多处修改 network_status 的代码只更新了 DB 而未失效轮询缓存(polling:card:{id}),
导致轮询系统持续读取旧缓存值,跳过 Gateway 停机调用。
修复方式:DB 更新后立即 Del 轮询缓存 key,下次轮询自动从 DB 重建。
涉及文件:
- StopResumeService: CheckAndStopCard/resumeSingleCard/ManualStopCard/ManualStartCard
- iot_card/Service: RefreshCardDataFromGateway(通过 OnCardStatusChanged 回调)
- device/Service: StopDevice/StartDevice
This commit is contained in:
@@ -876,6 +876,11 @@ func (s *Service) RefreshCardDataFromGateway(ctx context.Context, iccid string)
|
||||
}
|
||||
}
|
||||
|
||||
// 失效轮询缓存,确保轮询系统读到最新的 network_status/real_name_status/流量
|
||||
if s.pollingCallback != nil {
|
||||
s.pollingCallback.OnCardStatusChanged(ctx, card.ID)
|
||||
}
|
||||
|
||||
s.logger.Info("刷新卡数据成功",
|
||||
zap.String("iccid", iccid),
|
||||
zap.Uint("card_id", card.ID),
|
||||
|
||||
Reference in New Issue
Block a user