Files
water/.workbuddy/memory/2026-06-11.md

18 lines
946 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 2026-06-11 工作日志
### 14. DeviceDataHandler 和 DeviceRegisterHandler 补充设备在线状态刷新
**问题**:之前只有 ACK 应答会调用 `refreshDeviceOnline()` 续期 Redis 中的设备在线状态。但设备只要上报电量或注册就证明在线,这两个场景没刷新在线缓存。后果:设备只上报数据不发 ACK 时5 分钟后重试逻辑误判它为离线。
**修复**
- `DeviceDataHandler.handle()` → 收到 `/publish/power` 后调用 `refreshDeviceOnline()`
- `DeviceRegisterHandler.handle()` → 注册后调用 `refreshDeviceOnline()`
- 两个 Handler 各自注入 `MqttProperties`,避免注入 `MqttCommandAckService` 引入新的循环依赖
**在线判定覆盖**(修复后):
| 触发方式 | 是否刷新在线状态 |
|---|---|
| 设备上报电量 `/publish/power` | ✅ 新增 |
| 设备注册 `/publish/register` | ✅ 新增 |
| ACK 应答 `/publish/ack` | ✅ 原有 |