fix: 修复 RealtimeStatus 查询后未回写 DB 导致 Resolve 接口在线状态不同步的问题
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m12s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m12s
This commit is contained in:
@@ -356,6 +356,10 @@ func (s *Service) fetchDeviceGatewayInfo(ctx context.Context, deviceID uint) *dt
|
||||
return &dto.DeviceGatewayInfo{GatewayMsg: &msg}
|
||||
}
|
||||
|
||||
// 实时状态成功后异步回写 DB,保持 Resolve 接口的缓存与 Gateway 同步
|
||||
// 使用 context.Background() 避免请求结束后 ctx 取消导致写入失败
|
||||
go s.updateDeviceFromSyncInfo(context.Background(), deviceID, syncResp)
|
||||
|
||||
return mapSyncRespToDeviceGatewayInfo(syncResp)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user