Skip to content

Commit

Permalink
Fix peer timeout penalty
Browse files Browse the repository at this point in the history
  • Loading branch information
wizeguyy committed Oct 21, 2024
1 parent bc9341b commit e9ee381
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions p2p/node/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,10 @@ func (p *P2PNode) requestAndWait(peerID peer.ID, topic *pubsubManager.Topic, req
// Request timed out, return
log.Global.WithFields(log.Fields{
"peerId": peerID,
"message": "Request timed out, data not sent",
"message": "Request timed out, data not received",
}).Warning("Missed data request")
// Mark this peer as not responding
p.peerManager.AdjustPeerQuality(peerID, topic.String(), p2p.QualityAdjOnTimeout)
default:
// Optionally log the missed send or handle it in another way
log.Global.WithFields(log.Fields{
Expand All @@ -242,8 +244,6 @@ func (p *P2PNode) requestAndWait(peerID peer.ID, topic *pubsubManager.Topic, req
"topic": topic.String(),
"err": err,
}).Error("Error requesting the data from peer")
// Mark this peer as not responding
p.peerManager.AdjustPeerQuality(peerID, topic.String(), p2p.QualityAdjOnTimeout)
}
}

Expand Down

0 comments on commit e9ee381

Please sign in to comment.