Let bgp_peer_count drop to 0 (closes #92)
check / check (push) Canceled after 0s

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
This commit is contained in:
2026-10-19 10:27:45 +00:00
parent 3667d09800
commit 714e7f6f4e
2 changed files with 16 additions and 1 deletions
+1 -1
View File
@@ -168,7 +168,7 @@ func (t *Tracker) RecordWithdrawal() {
// SetBGPPeerCount updates the current BGP peer count
func (t *Tracker) SetBGPPeerCount(count int) {
// BGP peer count is always small (< 1000), so int32 is safe
if count > 0 && count < 1<<31 {
if count >= 0 && count < 1<<31 {
t.bgpPeerCount.Store(int32(count))
}
}