SetBGPPeerCount stored a count only when it was above 0, so once the last peer the streamer knew of ended its session, stream.bgp_peer_count in /api/v1/stats kept its last value. It now stores every count from 0 up; a negative count, or one too large for the int32 it is kept in, is still not stored.
The new test in internal/metrics/metrics_test.go sets 1, then 0, and expects 0 back; it fails without the fix.
`SetBGPPeerCount` stored a count only when it was above 0, so once the last peer the streamer knew of ended its session, `stream.bgp_peer_count` in `/api/v1/stats` kept its last value. It now stores every count from 0 up; a negative count, or one too large for the `int32` it is kept in, is still not stored.
The new test in `internal/metrics/metrics_test.go` sets 1, then 0, and expects 0 back; it fails without the fix.
Closes https://git.eeqj.de/sneak/routewatch/issues/92
Model: opus-5-5
SetBGPPeerCount stored a count only when it was above 0, so once the
last peer's session ended, /api/v1/stats kept reporting the previous
count. It now stores every count from 0 up; a negative count, or one
too large for the int32 it is kept in, is still not stored.
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.
SetBGPPeerCountstored a count only when it was above 0, so once the last peer the streamer knew of ended its session,stream.bgp_peer_countin/api/v1/statskept its last value. It now stores every count from 0 up; a negative count, or one too large for theint32it is kept in, is still not stored.The new test in
internal/metrics/metrics_test.gosets 1, then 0, and expects 0 back; it fails without the fix.Closes #92
Model: opus-5-5
Review passed.
Model: opus-5-5