reconnect_count in /api/v1/stats stayed 0 however often the RIS Live stream reconnected. SetConnected counted a reconnect only when the stream was still marked connected, or when the count was already above zero. The streamer always marks the stream disconnected before it connects again, so neither held.
SetConnected now counts one reconnect for every connection after the first. It recognises the first connection by connectedSince, the time of the latest connection, which is zero until then, so no new field is needed.
The new test in internal/metrics connects, disconnects, connects, disconnects and connects, and expects a count of 2; before the fix it got 0.
Not visible in the diff: calling SetConnected(true) twice with no disconnect between still counts a reconnect, as it did before. The streamer never does this.
Judgement call: no Completed Steps entry in TODO.md, because the brief allows TODO.md changes only where this change makes it wrong.
Model: opus-5-5
Fixes https://git.eeqj.de/sneak/routewatch/issues/68.
`reconnect_count` in `/api/v1/stats` stayed 0 however often the RIS Live stream reconnected. `SetConnected` counted a reconnect only when the stream was still marked connected, or when the count was already above zero. The streamer always marks the stream disconnected before it connects again, so neither held.
`SetConnected` now counts one reconnect for every connection after the first. It recognises the first connection by `connectedSince`, the time of the latest connection, which is zero until then, so no new field is needed.
The new test in `internal/metrics` connects, disconnects, connects, disconnects and connects, and expects a count of 2; before the fix it got 0.
Not visible in the diff: calling `SetConnected(true)` twice with no disconnect between still counts a reconnect, as it did before. The streamer never does this.
Judgement call: no Completed Steps entry in `TODO.md`, because the brief allows `TODO.md` changes only where this change makes it wrong.
Model: opus-5-5
SetConnected counted a reconnect only if the stream was still marked
connected or the count was already above zero. The streamer always marks
the stream disconnected before connecting again, so the count stayed 0.
It now counts one reconnect for every connection after the first, using
the time of the previous connection, which is zero until the first one.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes #68.
reconnect_countin/api/v1/statsstayed 0 however often the RIS Live stream reconnected.SetConnectedcounted a reconnect only when the stream was still marked connected, or when the count was already above zero. The streamer always marks the stream disconnected before it connects again, so neither held.SetConnectednow counts one reconnect for every connection after the first. It recognises the first connection byconnectedSince, the time of the latest connection, which is zero until then, so no new field is needed.The new test in
internal/metricsconnects, disconnects, connects, disconnects and connects, and expects a count of 2; before the fix it got 0.Not visible in the diff: calling
SetConnected(true)twice with no disconnect between still counts a reconnect, as it did before. The streamer never does this.Judgement call: no Completed Steps entry in
TODO.md, because the brief allowsTODO.mdchanges only where this change makes it wrong.Model: opus-5-5
Review passed.
Model: opus-5-5