From 451dc262b201089dd7016094cf1911b30fea9525 Mon Sep 17 00:00:00 2001 From: matlorr Date: Fri, 10 Jan 2025 10:13:36 +0100 Subject: [PATCH] Fixed display error of server capacity by performing rounding as last step. --- .gitignore | 1 + client/src/components/landing_page.tsx | 4 ++-- relay/stats.sh | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 72e3323..c0120b2 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ server/.lake **/.DS_Store logs/ relay/prev_cpu_metric +test.ecosystem.config.cjs diff --git a/client/src/components/landing_page.tsx b/client/src/components/landing_page.tsx index b69f50c..6080eeb 100644 --- a/client/src/components/landing_page.tsx +++ b/client/src/components/landing_page.tsx @@ -193,8 +193,8 @@ function LandingPage() {

- { usageMem >= 0 && <> {t("RAM")}: {usageMem} %{t(" used")}.
} - { usageCPU >= 0 && <> {t("CPU")}: {usageCPU} %{t(" used")}. } + { usageMem >= 0 && <> {t("RAM")}: {usageMem.toFixed(2)} %{t(" used")}.
} + { usageCPU >= 0 && <> {t("CPU")}: {usageCPU.toFixed(2)} %{t(" used")}. }

diff --git a/relay/stats.sh b/relay/stats.sh index 8996046..07e6972 100755 --- a/relay/stats.sh +++ b/relay/stats.sh @@ -3,10 +3,10 @@ # Load python interpreter python=/usr/bin/python3 # Load python script -cpu_usage=$L4G_DIR/lean4game/relay/cpu_usage.py +cpu_usage=relay/cpu_usage.py # Execute python script cpu=$($python $cpu_usage) # Calculate memory usage by computing used_memory/total_memory mem=$(free | sed '2q;d' | awk '{print $3/$2}') -printf "CPU, MEM\n%.2f, %.2f\n" $cpu $mem +printf "CPU, MEM\n%f, %f\n" $cpu $mem