Repository navigation
fix: load device info when server is updating - #985
dengzhongyuan365-dev wants to merge 1 commit into
Conversation
1. Root cause: LoadInfoThread::run() skipped data loading entirely when is_server_running returned "1", leaving DeviceManager empty 2. Fix: replace skip with polling loop (500ms interval, 30s timeout) that waits for server update to finish, then loads data normally 3. Impact: device info always loads regardless of server state; max 30s delay when server is updating, with fallback load on timeout Log: Fixed incomplete device info after reopening device manager Influence: 1. Test reopening device manager while server is updating 2. Verify device info displays completely after multiple opens 3. Test app shutdown during server update polling (no hang) fix: 服务端更新时加载设备信息 1. 根因:LoadInfoThread::run() 在 is_server_running 返回 "1" 时完全 跳过数据加载,导致 DeviceManager 为空,信息显示不全 2. 方案:将跳过改为轮询等待(500ms 间隔,30s 超时),等待服务端更新 完成后正常加载数据;超时后仍执行本地加载作为兜底 3. 影响:设备信息始终加载,不再因服务端状态跳过;服务端更新期间 最多延迟 30s,超时后降级加载 Log: 修复多次打开设备管理器后信息显示不全的问题 Influence: 1. 测试服务端更新时重新打开设备管理器 2. 验证多次打开后设备信息完整显示 3. 测试轮询等待期间关闭应用(无挂起) PMS: BUG-378099
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dengzhongyuan365-dev The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's GuideImplementationPoll the backend while it is updating, then run the existing data-loading path unconditionally, with a 30-second timeout fallback.
TestsUpdate the server-running test to expect loading after the polling timeout and stub the clock for deterministic execution.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
TAG Bot New tag: 6.0.77 |
Root Cause Analysis
When the device manager is reopened while the backend server is updating (up to 60s),
LoadInfoThread::run()checksis_server_runningvia DBus. If it returns "1" (updating), theelsebranch completely skips data loading and directly emitsfinished("finish"), leavingDeviceManagerempty — so the UI shows incomplete device info. This triggers when: first open loads data → triggersrefreshDataBaseLater()→ server starts updating → user closes & reopens →is_server_running=1→ skip loading → empty UI.Fix
Replace the skip-when-server-running logic with a polling loop: when
is_server_runningreturns "1", poll every 500ms (with a 30s timeout) until the server finishes updating, then proceed with normal data loading. On timeout, fall back to loading with current data as a safety net. Theelsebranch ("do nothing") is removed entirely — data loading now runs unconditionally after the polling check.Change Safety Assessment
Code Safety
LoadInfoThread::run()internal logic change — no signature change, no new public interfaceelsebranch (skip loading) was original design from commitd44d9ac9, not a prior bug fix product — this change does not revert any historical fixUT_LoadInfoThread::Run_ServerRunning_SkipsHeavyPathcovers this behavior path and will need updating to reflect new behavior (pending user decision)Business Impact Scope
LoadInfoThread::run(),MainWindow::slotLoadingFinish()Verification Suggestion
根因分析
当设备管理器在后端服务正在更新时(最长 60 秒)被重新打开,
LoadInfoThread::run()通过 DBus 检查is_server_running。如果返回 "1"(正在更新),else分支完全跳过数据加载,直接发射finished("finish")信号,导致DeviceManager为空——因此 UI 显示不全。触发链路:首次打开加载数据 → 触发refreshDataBaseLater()→ 服务端开始更新 → 用户关闭再打开 →is_server_running=1→ 跳过加载 → UI 为空。修复方案
将"服务端运行时跳过"逻辑替换为轮询等待:当
is_server_running返回 "1" 时,每 500ms 轮询一次(30 秒超时),等待服务端更新完成后执行正常数据加载。超时后降级为本地加载作为兜底。else分支("do nothing")被完全移除——数据加载现在在轮询检查后无条件执行。改动安全评估
代码安全评估
LoadInfoThread::run()内部逻辑改动——不改签名、不新增公开接口else分支(跳过加载)是 commitd44d9ac9的原始设计,非历史 bug 修复产物——本次改动不撤销任何历史修复UT_LoadInfoThread::Run_ServerRunning_SkipsHeavyPath覆盖该行为路径,需更新以反映新行为(待用户决定)业务影响范围
LoadInfoThread::run()、MainWindow::slotLoadingFinish()验证建议
Summary by Sourcery
Load device information reliably while the backend server is updating.
Bug Fixes:
Tests: