Skip to content

Commit

Permalink
fix(timecache): remove panic in first seen cache on Add (libp2p#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wondertan authored Feb 21, 2023
1 parent cda3df7 commit 3dbc2fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion timecache/first_seen_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion timecache/time_cache.go
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 3dbc2fd

Please sign in to comment.