From 74654af840d0a71379883a426be57b102a545559 Mon Sep 17 00:00:00 2001 From: Wondertan Date: Tue, 21 Feb 2023 12:08:50 +0100 Subject: [PATCH] fix(timecache): remove panic in first seen cache on Add --- timecache/first_seen_cache.go | 3 ++- timecache/time_cache.go | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/timecache/first_seen_cache.go b/timecache/first_seen_cache.go index f8626aeb..351631c4 100644 --- a/timecache/first_seen_cache.go +++ b/timecache/first_seen_cache.go @@ -29,7 +29,8 @@ func (tc FirstSeenCache) Add(s string) { _, ok := tc.m[s] if ok { - panic("putting the same entry twice not supported") + log.Debug("first-seen: got same entry") + return } // TODO(#515): Do GC in the background diff --git a/timecache/time_cache.go b/timecache/time_cache.go index f10ff214..2a67b4a7 100644 --- a/timecache/time_cache.go +++ b/timecache/time_cache.go @@ -1,6 +1,12 @@ package timecache -import "time" +import ( + "time" + + logger "github.com/ipfs/go-log/v2" +) + +var log = logger.Logger("pubsub/timecache") type Strategy uint8