Skip to content

Commit

Permalink
fix: hearbeat tick handler rounding issue (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths committed Sep 20, 2021
1 parent 751ea73 commit a6d24de
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ts/heartbeat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export class Heartbeat {
// now compute the median peer score in the mesh
const peersList = Array.from(peers)
.sort((a, b) => getScore(a) - getScore(b))
const medianIndex = peers.size / 2
const medianIndex = Math.floor(peers.size / 2)
const medianScore = getScore(peersList[medianIndex])

// if the median score is below the threshold, select a better peer (if any) and GRAFT
Expand Down

0 comments on commit a6d24de

Please sign in to comment.