multi: store peer flap rate on disk on best effort basis
Since we will use peer flap rate to determine how we rate limit, we store this value on disk per peer per channel. This allows us to restart with memory of our peers past behaviour, so we don't give badly behaving peers have a fresh start on restart. Last flap timestamp is stored with our flap count so that we can degrade this all time flap count over time for peers that have not recently flapped.
This commit is contained in:
9 files changed
+435
-19
No files matched your search
@@ -12,7 +12,7 @@ import (
|
||||
// TestPeerLog tests the functionality of the peer log struct.
|
||||
func TestPeerLog(t *testing.T) {
|
||||
clock := clock.NewTestClock(testNow)
|
||||
peerLog := newPeerLog(clock)
|
||||
peerLog := newPeerLog(clock, 0, nil)
|
||||
|
||||
// assertFlapCount is a helper that asserts that our peer's flap count
|
||||
// and timestamp is set to expected values.
|
||||
@@ -135,7 +135,7 @@ func TestRateLimitAdd(t *testing.T) {
|
||||
mockedClock := clock.NewTestClock(testNow)
|
||||
|
||||
// Create a new peer log.
|
||||
peerLog := newPeerLog(mockedClock)
|
||||
peerLog := newPeerLog(mockedClock, 0, nil)
|
||||
require.Nil(t, peerLog.stagedEvent)
|
||||
|
||||
// Create a channel for our peer log, otherwise it will not track online
|
||||
|
||||
Reference in new issue
Block a user