Merge pull request #148 from libp2p/feat/timecache

make timecache duration configurable
This commit is contained in:
vyzo 2019-01-15 16:12:16 +02:00 committed by GitHub
commit fef794ab97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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()),
}