Keep taking messages while a peer's session goes down (closes #216)
check / check (push) Canceled after 0s

The table's PeerDown visits every prefix under the write lock, which
takes over a second on a full table. The prefix handler called it
inline, so its queue filled and the streamer dropped updates.

PeerDown now lets the lock go after every 10,000 prefixes. The handler
runs it on a goroutine of its own, one peer at a time, and holds back
the down peer's later messages until it returns, then applies them in
order. Stop waits for this before its last flush, and logs the
held-back messages it could not apply.

Model: opus-5-5
This commit is contained in:
2026-11-02 00:18:03 +00:00
parent 38b43549b9
commit 6b02cee68b
9 changed files with 337 additions and 47 deletions
+3 -1
View File
@@ -442,7 +442,9 @@ the routing table, and everything else from the database.
- An announcement gives the peer a route to the prefix.
- A withdrawal removes the peer's route. So does an announcement whose
AS path is empty or holds AS 0 anywhere.
- A peer whose BGP session goes down leaves every prefix.
- A peer whose BGP session goes down leaves every prefix. The handler
holds back the peer's later updates until it has left them all, then
applies them in order.
Every second it writes the changed prefix and origin AS pairs to the
`routes` table. A write takes at most 20,000 pairs, and the rest follow