No description
handleMhiStatus() rewrites the whole cached row from an in-memory cumulative state object on every single signal message, via an unawaited pool.query() per message. When several retained signals for the same unit arrive in a tight burst (e.g. right after a broker reconnect), their DB writes can complete out of dispatch order — an older write, captured before a later tempAmbientSts update was known, could land in Postgres AFTER a newer write that already had the correct room temp, silently reverting it to stale/null. User reported AC room temp "randomly" missing from the dashboard while the correct value was visible in the broker's retained topic — exactly this symptom, not an MQTT delivery gap. Fixed by chaining each unit's writes through a per-externalRef promise queue (mhiWriteChain) so completion order can never diverge from dispatch order. state is read at actual write time, not snapshotted early, so a queued write still picks up whatever's freshest by the time its turn comes up. |
||
|---|---|---|
| backend | ||
| docs | ||
| frontend | ||
| .gitignore | ||
| docker-compose.yml | ||
| seed-app.js | ||