From 51369f756f3b2ceb6073b6c6db3d1ca281db4226 Mon Sep 17 00:00:00 2001 From: Yusef Napora Date: Mon, 11 May 2020 11:08:24 -0400 Subject: [PATCH] increase decaying tag interval --- tag_tracer.go | 6 ++---- tag_tracer_test.go | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/tag_tracer.go b/tag_tracer.go index 6caa32c..ce0e326 100644 --- a/tag_tracer.go +++ b/tag_tracer.go @@ -30,7 +30,7 @@ var ( GossipSubConnTagBumpMessageDelivery = 1 // GossipSubConnTagDecayInterval is the decay interval for decaying connection manager tags. - GossipSubConnTagDecayInterval = time.Minute + GossipSubConnTagDecayInterval = 10 * time.Minute // GossipSubConnTagDecayAmount is subtracted from decaying tag values at each decay interval. GossipSubConnTagDecayAmount = 1 @@ -50,9 +50,7 @@ var ( // - For each message that we receive, we bump a delivery tag for peer that delivered the message // first. // The delivery tags have a maximum value, GossipSubConnTagMessageDeliveryCap, and they decay at -// a rate of GossipSubConnTagDecayAmount / GossipSubConnTagDecayInterval (default 1/minute). -// With the defaults, a peer who stops delivering messages will have their delivery tag decay to zero -// in fifteen minutes. +// a rate of GossipSubConnTagDecayAmount / GossipSubConnTagDecayInterval. type tagTracer struct { sync.Mutex diff --git a/tag_tracer_test.go b/tag_tracer_test.go index c62d51e..e27f5a5 100644 --- a/tag_tracer_test.go +++ b/tag_tracer_test.go @@ -122,8 +122,8 @@ func TestTagTracerDeliveryTags(t *testing.T) { t.Errorf("expected delivery tag value = %d, got %d", expected, val) } - // if we jump forward a few minutes, we should see the tags decrease by 1 / minute - clk.Add(5 * time.Minute) + // if we jump forward a few minutes, we should see the tags decrease by 1 / 10 minutes + clk.Add(50 * time.Minute) val = getTagValue(cmgr, p, "pubsub-deliveries:topic-1") expected = GossipSubConnTagMessageDeliveryCap - 5