fix: shut the fuck up, peer log

This commit is contained in:
Cassandra Heart 2025-10-05 23:51:09 -05:00
parent f6bade89bf
commit e0393aa34d
No known key found for this signature in database
GPG Key ID: 371083BFA6C240AA
2 changed files with 15 additions and 14 deletions

View File

@ -20,6 +20,8 @@ type PeerConnector interface {
Connect(context.Context) error
}
// TODO(2.1.1+): metrics only, no debug logging unless configurable logging, too
// noisy
type peerConnector struct {
ctx context.Context
logger *zap.Logger
@ -94,7 +96,6 @@ func (pc *peerConnector) connectToPeer(
case <-ctx.Done():
return
case <-time.After(identify.DefaultTimeout / 2):
logger.Debug("identifying peer timed out")
atomic.AddUint32(failure, 1)
_ = conn.Close()
case <-pc.idService.IdentifyWait(conn):
@ -114,7 +115,6 @@ func (pc *peerConnector) connectToPeers(
logger := pc.logger.With(zap.String("peer_id", p.ID.String()))
if atomic.LoadUint32(success) >= uint32(pc.minPeers) {
logger.Debug("reached max findings")
return
}
@ -140,16 +140,7 @@ func (pc *peerConnector) connectToPeers(
func (pc *peerConnector) connect() {
logger := pc.logger
logger.Debug("initiating peer connections")
var success, failure, duplicate uint32
defer func() {
logger.Debug(
"completed peer connections",
zap.Uint32("success", success),
zap.Uint32("failure", failure),
zap.Uint32("duplicate", duplicate),
)
}()
ctx, cancel := context.WithCancel(pc.ctx)
defer cancel()

View File

@ -20,7 +20,10 @@ type staticPeerSource struct {
}
// Peers implements PeerSource.
func (s *staticPeerSource) Peers(context.Context) (<-chan peer.AddrInfo, error) {
func (s *staticPeerSource) Peers(context.Context) (
<-chan peer.AddrInfo,
error,
) {
peers := s.peers
if s.permute {
peers = Permuted(s.peers)
@ -45,12 +48,19 @@ type routingDiscoveryPeerSource struct {
}
// Peers implements PeerSource.
func (d *routingDiscoveryPeerSource) Peers(ctx context.Context) (<-chan peer.AddrInfo, error) {
func (d *routingDiscoveryPeerSource) Peers(ctx context.Context) (
<-chan peer.AddrInfo,
error,
) {
return d.discovery.FindPeers(ctx, d.namespace, discovery.Limit(d.limit))
}
// NewRoutingDiscoveryPeerSource creates a new discovery peer source.
func NewRoutingDiscoveryPeerSource(discovery *routing.RoutingDiscovery, namespace string, limit int) PeerSource {
func NewRoutingDiscoveryPeerSource(
discovery *routing.RoutingDiscovery,
namespace string,
limit int,
) PeerSource {
return &routingDiscoveryPeerSource{
discovery: discovery,
namespace: namespace,