Merge pull request #303 from status-im/heartbeat

Fix hearbeat tick handler rounding issue
This commit is contained in:
Franck Royer 2021-09-24 15:41:08 +10:00 committed by GitHub
commit 0482239e8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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