diff --git a/tag_tracer.go b/tag_tracer.go index 6b57a4f..fa34173 100644 --- a/tag_tracer.go +++ b/tag_tracer.go @@ -119,9 +119,15 @@ func (t *tagTracer) addDeliveryTag(topic string) { return } + name := fmt.Sprintf("pubsub-deliveries:%s", topic) t.Lock() defer t.Unlock() - tag, err := t.decayingDeliveryTag(topic) + tag, err := t.decayer.RegisterDecayingTag( + name, + GossipSubConnTagDecayInterval, + connmgr.DecayFixed(GossipSubConnTagDecayAmount), + connmgr.BumpSumBounded(0, GossipSubConnTagMessageDeliveryCap)) + if err != nil { log.Warnf("unable to create decaying delivery tag: %s", err) return @@ -143,19 +149,6 @@ func (t *tagTracer) removeDeliveryTag(topic string) { delete(t.decaying, topic) } -func (t *tagTracer) decayingDeliveryTag(topic string) (connmgr.DecayingTag, error) { - if t.decayer == nil { - return nil, fmt.Errorf("connection manager does not support decaying tags") - } - name := fmt.Sprintf("pubsub-deliveries:%s", topic) - - return t.decayer.RegisterDecayingTag( - name, - GossipSubConnTagDecayInterval, - connmgr.DecayFixed(GossipSubConnTagDecayAmount), - connmgr.BumpSumBounded(0, GossipSubConnTagMessageDeliveryCap)) -} - func (t *tagTracer) bumpDeliveryTag(p peer.ID, topic string) error { t.RLock() defer t.RUnlock()