Fix hearbeat tick handler rounding issue

807bf282c5
This commit is contained in:
Franck Royer 2021-09-24 10:36:19 +10:00
parent 30e063a8eb
commit d875994908
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 1 additions and 1 deletions

View File

@ -276,7 +276,7 @@ export class RelayHeartbeat extends Heartbeat {
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