[client] stream_measurements: skip malformed frames instead of raising bare KeyError (kills reconnect loop) #179
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Two bare indexing sites raise
KeyErroron a malformed frame:Measurement.from_measurereadsmeasure["value"],measure["capacityId"],measure["measureKind"](_streaming.py:86-89);payload["gatewayUid"](_streaming.py:157).In reconnect mode, a malformed frame therefore escapes the generator as a bare
KeyError, killing the reconnect loop instead of surfacing asComwattStreamingErroror being skipped. A single glitched frame takes down a stream meant to survive.Fix: tolerate malformed frames — skip anything that does not parse (missing keys / wrong shapes), keeping the loop alive; only transport-level failures should raise. Silence + survival is the minimum bar; a debug hook surfacing skipped frames is optional.
Done when: a malformed measures frame is skipped and subsequent valid frames still yield — covered by a test feeding a bad frame mid-stream in reconnect mode.