fix: 修复 RealtimeStatus 查询后未回写 DB 导致 Resolve 接口在线状态不同步的问题
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m12s

This commit is contained in:
2026-04-02 15:14:04 +08:00
parent 8980e6d999
commit a8a91fe04e

View File

@@ -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)
}