From dcde0015f42200612bbc23207c89678cff3af7d7 Mon Sep 17 00:00:00 2001 From: CombatPug Date: Wed, 24 Apr 2024 22:40:33 +0100 Subject: [PATCH 1/3] fix: instead of join v1 use new `standby` number (from cycleChain) --- src/p2p/NodeList.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p2p/NodeList.ts b/src/p2p/NodeList.ts index 3a5c2c402..9e2dd3b5a 100644 --- a/src/p2p/NodeList.ts +++ b/src/p2p/NodeList.ts @@ -49,7 +49,7 @@ export function init() { active: activeByIdOrder.length, syncing: syncingByIdOrder.length, ready: readyByTimeAndIdOrder.length, - standby: Join.getNodeRequestingJoin().length, + standby: CycleChain.newest.standby, desired: CycleChain.newest.desired, } return res.send(safeStringify(networkStats)) From 705bbaf20242a8c5665cfaf7d5635f085b1fb578 Mon Sep 17 00:00:00 2001 From: CombatPug Date: Fri, 26 Apr 2024 13:38:34 +0100 Subject: [PATCH 2/3] refactor: use standby count from join v2 map and use desired from AutoScaler --- src/p2p/NodeList.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/p2p/NodeList.ts b/src/p2p/NodeList.ts index 9e2dd3b5a..87fcacd42 100644 --- a/src/p2p/NodeList.ts +++ b/src/p2p/NodeList.ts @@ -14,6 +14,8 @@ import { logFlags } from '../logger' import { nestedCountersInstance } from '..' import { shardusGetTime } from '../network' import { safeStringify } from '../utils' +import { standbyNodesInfo } from "./Join/v2"; +import { getDesiredCount } from "./CycleAutoScale"; const clone = rfdc() @@ -49,8 +51,8 @@ export function init() { active: activeByIdOrder.length, syncing: syncingByIdOrder.length, ready: readyByTimeAndIdOrder.length, - standby: CycleChain.newest.standby, - desired: CycleChain.newest.desired, + standby: standbyNodesInfo.size, + desired: getDesiredCount(), } return res.send(safeStringify(networkStats)) } catch (e) { From e818c7cca806fe646091d449455a96d8411c653f Mon Sep 17 00:00:00 2001 From: CombatPug Date: Fri, 26 Apr 2024 13:40:00 +0100 Subject: [PATCH 3/3] fix: use the getter instead of direct field access for standbyNodes --- src/p2p/NodeList.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p2p/NodeList.ts b/src/p2p/NodeList.ts index 87fcacd42..37cd0042a 100644 --- a/src/p2p/NodeList.ts +++ b/src/p2p/NodeList.ts @@ -14,7 +14,7 @@ import { logFlags } from '../logger' import { nestedCountersInstance } from '..' import { shardusGetTime } from '../network' import { safeStringify } from '../utils' -import { standbyNodesInfo } from "./Join/v2"; +import { getStandbyNodesInfoMap, standbyNodesInfo } from "./Join/v2"; import { getDesiredCount } from "./CycleAutoScale"; const clone = rfdc() @@ -51,7 +51,7 @@ export function init() { active: activeByIdOrder.length, syncing: syncingByIdOrder.length, ready: readyByTimeAndIdOrder.length, - standby: standbyNodesInfo.size, + standby: getStandbyNodesInfoMap().size, desired: getDesiredCount(), } return res.send(safeStringify(networkStats))