fix(nodes): stop showing wrong node uptime for multi-node clusters
Some checks failed
Deploy to Production / Trigger production update (push) Has been cancelled
Some checks failed
Deploy to Production / Trigger production update (push) Has been cancelled
Server card used Math.max over all cluster nodes' uptime, so rebooting one node still showed another node's higher uptime, making it look like the reboot had no effect.
This commit is contained in:
@@ -31,7 +31,10 @@ function ServerMeta({ serverId, online }: { serverId: number; online?: boolean }
|
|||||||
const nodes = data?.nodes ?? [];
|
const nodes = data?.nodes ?? [];
|
||||||
if (nodes.length === 0) return null;
|
if (nodes.length === 0) return null;
|
||||||
|
|
||||||
const uptime = nodes.reduce((max, n) => Math.max(max, n.uptime ?? 0), 0);
|
// Аптайм показываем только для standalone-сервера (1 нода): для кластера
|
||||||
|
// из нескольких нод единое число вводит в заблуждение — при перезагрузке
|
||||||
|
// одной ноды отображался бы аптайм другой, ещё не перезагруженной.
|
||||||
|
const uptime = nodes.length === 1 ? (nodes[0].uptime ?? 0) : 0;
|
||||||
const version = data?.version;
|
const version = data?.version;
|
||||||
|
|
||||||
if (!version && nodes.length <= 1 && uptime <= 0) return null;
|
if (!version && nodes.length <= 1 && uptime <= 0) return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user