Skip to content

Commit

Permalink
Reduce mem usage on message time cache
Browse files Browse the repository at this point in the history
  • Loading branch information
h0n9 committed Jul 18, 2023
1 parent 7f75302 commit 9fdc76c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion relayer/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,16 @@ func NewRelayer(ctx context.Context, logger *zerolog.Logger, seed []byte, addrs
subLogger.Info().Msgf("listening address %v", h.Addrs())
subLogger.Info().Msgf("libp2p peer ID %s", h.ID())

ps, err := pubsub.NewGossipSub(ctx, h)
// TODO: make this options customizable with external config file
ps, err := pubsub.NewGossipSub(
ctx,
h,
// msgs routing internally don't need to be signed and verified
pubsub.WithMessageSigning(false),
// msgs are removed from time cache after 3 seconds since first seen
pubsub.WithSeenMessagesTTL(3*time.Second),
pubsub.WithSeenMessagesStrategy(timecache.Strategy_FirstSeen),
)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 9fdc76c

Please sign in to comment.