make timecache duration configurable

This commit is contained in:
vyzo 2019-01-15 15:39:13 +02:00
parent 2e1fb613f9
commit 04f90acd17

View File

@ -25,6 +25,10 @@ const (
defaultValidateThrottle = 8192
)
var (
TimeCacheDuration = 120 * time.Second
)
var log = logging.Logger("pubsub")
// PubSub is the implementation of the pubsub system.
@ -175,7 +179,7 @@ func NewPubSub(ctx context.Context, h host.Host, rt PubSubRouter, opts ...Option
topics: make(map[string]map[peer.ID]struct{}),
peers: make(map[peer.ID]chan *RPC),
topicVals: make(map[string]*topicVal),
seenMessages: timecache.NewTimeCache(time.Second * 120),
seenMessages: timecache.NewTimeCache(TimeCacheDuration),
counter: uint64(time.Now().UnixNano()),
}