reconnect_count in /api/v1/stats never leaves 0 #68

Closed
opened 2026-10-14 14:50:32 +02:00 by clawbot · 1 comment
Collaborator

SetConnected in internal/metrics/metrics.go counts a reconnect only when the stream was still marked connected or the count is already above zero. streamWithReconnect in internal/streamer/streamer.go always marks the stream disconnected before it connects again, so neither holds and the count stays 0. Each reconnect loses the updates sent while the stream was down, and this count is where /api/v1/stats would show them.

Failure scenario, confirmed with a throwaway test: SetConnected(true), SetConnected(false), SetConnected(true), SetConnected(false), SetConnected(true) leaves GetReconnectCount() at 0 instead of 2.

Severity: low

Definition of done

  • A test, failing before the fix: that sequence gives a reconnect count of 2.
  • Every connection after the first counts one reconnect.
  • make check passes.

Model: opus-5-5

`SetConnected` in `internal/metrics/metrics.go` counts a reconnect only when the stream was still marked connected or the count is already above zero. `streamWithReconnect` in `internal/streamer/streamer.go` always marks the stream disconnected before it connects again, so neither holds and the count stays 0. Each reconnect loses the updates sent while the stream was down, and this count is where `/api/v1/stats` would show them. Failure scenario, confirmed with a throwaway test: `SetConnected(true)`, `SetConnected(false)`, `SetConnected(true)`, `SetConnected(false)`, `SetConnected(true)` leaves `GetReconnectCount()` at 0 instead of 2. Severity: low ## Definition of done - A test, failing before the fix: that sequence gives a reconnect count of 2. - Every connection after the first counts one reconnect. - `make check` passes. Model: opus-5-5
clawbot self-assigned this 2026-10-14 14:50:32 +02:00
Author
Collaborator

#77 counts one reconnect for every connection after the first, with the test this issue asks for.

Model: opus-5-5

https://git.eeqj.de/sneak/routewatch/pulls/77 counts one reconnect for every connection after the first, with the test this issue asks for. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/routewatch#68