ax(node): rename rtt to roundTripTime in PingPeer
AX Principle #1: names must not require a comment to explain. The comment "Calculate round-trip time" existed solely to decode the abbreviation rtt — proof the name was too short. Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
93ca88e2e3
commit
c85217dfca
1 changed files with 3 additions and 4 deletions
|
|
@ -294,16 +294,15 @@ func (c *Controller) PingPeer(peerID string) (float64, error) {
|
|||
return 0, err
|
||||
}
|
||||
|
||||
// Calculate round-trip time
|
||||
rtt := time.Since(sentAt).Seconds() * 1000 // Convert to ms
|
||||
roundTripTime := time.Since(sentAt).Seconds() * 1000 // milliseconds
|
||||
|
||||
// Update peer metrics
|
||||
peer := c.peers.GetPeer(peerID)
|
||||
if peer != nil {
|
||||
c.peers.UpdateMetrics(peerID, rtt, peer.GeoKM, peer.Hops)
|
||||
c.peers.UpdateMetrics(peerID, roundTripTime, peer.GeoKM, peer.Hops)
|
||||
}
|
||||
|
||||
return rtt, nil
|
||||
return roundTripTime, nil
|
||||
}
|
||||
|
||||
// ConnectToPeer establishes a connection to a peer.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue