mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-08 16:53:10 +00:00
Merge pull request #303 from status-im/heartbeat
Fix hearbeat tick handler rounding issue
This commit is contained in:
commit
0482239e8b
@ -276,7 +276,7 @@ export class RelayHeartbeat extends Heartbeat {
|
|||||||
const peersList = Array.from(peers).sort(
|
const peersList = Array.from(peers).sort(
|
||||||
(a, b) => getScore(a) - getScore(b)
|
(a, b) => getScore(a) - getScore(b)
|
||||||
);
|
);
|
||||||
const medianIndex = peers.size / 2;
|
const medianIndex = Math.floor(peers.size / 2);
|
||||||
const medianScore = getScore(peersList[medianIndex]);
|
const medianScore = getScore(peersList[medianIndex]);
|
||||||
|
|
||||||
// if the median score is below the threshold, select a better peer (if any) and GRAFT
|
// if the median score is below the threshold, select a better peer (if any) and GRAFT
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user