Skip to content

Commit

Permalink
chore: (discovery) reduce "skipped peers" logs
Browse files Browse the repository at this point in the history
  • Loading branch information
moshe-blox committed Oct 27, 2024
1 parent 0bc6433 commit 1f314ef
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion network/discovery/dv5_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,22 @@ func (dvs *DiscV5Service) Node(logger *zap.Logger, info peer.AddrInfo) (*enode.N
func (dvs *DiscV5Service) Bootstrap(logger *zap.Logger, handler HandleNewPeer) error {
logger = logger.Named(logging.NameDiscoveryService)

// Log every 10th skipped peer.
// TODO: remove once we've merged https://github.com/ssvlabs/ssv/pull/1803
const logFrequency = 10
var skippedPeers = 0

dvs.discover(dvs.ctx, func(e PeerEvent) {
logger := logger.With(
fields.ENR(e.Node),
fields.PeerID(e.AddrInfo.ID),
)
err := dvs.checkPeer(logger, e)
if err != nil {
logger.Debug("skipped discovered peer", zap.Error(err))
if skippedPeers%logFrequency == 0 {
logger.Debug("skipped discovered peer", zap.Error(err))
}
skippedPeers++
return
}
handler(e)
Expand Down

0 comments on commit 1f314ef

Please sign in to comment.