increase decaying tag interval

This commit is contained in:
Yusef Napora 2020-05-11 11:08:24 -04:00 committed by vyzo
parent f87e7b72d7
commit 51369f756f
2 changed files with 4 additions and 6 deletions

View File

@ -30,7 +30,7 @@ var (
GossipSubConnTagBumpMessageDelivery = 1 GossipSubConnTagBumpMessageDelivery = 1
// GossipSubConnTagDecayInterval is the decay interval for decaying connection manager tags. // 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 is subtracted from decaying tag values at each decay interval.
GossipSubConnTagDecayAmount = 1 GossipSubConnTagDecayAmount = 1
@ -50,9 +50,7 @@ var (
// - For each message that we receive, we bump a delivery tag for peer that delivered the message // - For each message that we receive, we bump a delivery tag for peer that delivered the message
// first. // first.
// The delivery tags have a maximum value, GossipSubConnTagMessageDeliveryCap, and they decay at // The delivery tags have a maximum value, GossipSubConnTagMessageDeliveryCap, and they decay at
// a rate of GossipSubConnTagDecayAmount / GossipSubConnTagDecayInterval (default 1/minute). // a rate of GossipSubConnTagDecayAmount / GossipSubConnTagDecayInterval.
// With the defaults, a peer who stops delivering messages will have their delivery tag decay to zero
// in fifteen minutes.
type tagTracer struct { type tagTracer struct {
sync.Mutex sync.Mutex

View File

@ -122,8 +122,8 @@ func TestTagTracerDeliveryTags(t *testing.T) {
t.Errorf("expected delivery tag value = %d, got %d", expected, val) 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 // if we jump forward a few minutes, we should see the tags decrease by 1 / 10 minutes
clk.Add(5 * time.Minute) clk.Add(50 * time.Minute)
val = getTagValue(cmgr, p, "pubsub-deliveries:topic-1") val = getTagValue(cmgr, p, "pubsub-deliveries:topic-1")
expected = GossipSubConnTagMessageDeliveryCap - 5 expected = GossipSubConnTagMessageDeliveryCap - 5