From 8570ef0f468b311246a64391280a1ec20901e765 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 28 May 2024 19:05:06 +0200 Subject: [PATCH] p2p/discover: fix test --- p2p/discover/table_reval.go | 4 +++- p2p/discover/table_test.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/p2p/discover/table_reval.go b/p2p/discover/table_reval.go index d02733f492..d12980b45c 100644 --- a/p2p/discover/table_reval.go +++ b/p2p/discover/table_reval.go @@ -28,6 +28,8 @@ import ( const never = mclock.AbsTime(math.MaxInt64) +const slowRevalidationFactor = 3 + // tableRevalidation implements the node revalidation process. // It tracks all nodes contained in Table, and schedules sending PING to them. type tableRevalidation struct { @@ -48,7 +50,7 @@ func (tr *tableRevalidation) init(cfg *Config) { tr.fast.interval = cfg.PingInterval tr.fast.name = "fast" tr.slow.nextTime = never - tr.slow.interval = cfg.PingInterval * 3 + tr.slow.interval = cfg.PingInterval * slowRevalidationFactor tr.slow.name = "slow" } diff --git a/p2p/discover/table_test.go b/p2p/discover/table_test.go index 0d833f82b5..618221c9b9 100644 --- a/p2p/discover/table_test.go +++ b/p2p/discover/table_test.go @@ -131,7 +131,7 @@ func waitForRevalidationPing(t *testing.T, transport *pingRecorder, tab *Table, simclock := tab.cfg.Clock.(*mclock.Simulated) maxAttempts := tab.len() * 8 for i := 0; i < maxAttempts; i++ { - simclock.Run(tab.cfg.PingInterval) + simclock.Run(tab.cfg.PingInterval * slowRevalidationFactor) p := transport.waitPing(2 * time.Second) if p == nil { t.Fatal("Table did not send revalidation ping")