Judge load on the Watchdog page against the same count the watchdog uses
The page multiplies its core count by the RW_LOAD_* multipliers to colour the load bar, and resource_watchdog.sh computes its real thresholds from nproc. The page preferred the API's physical core count — 16 against 32 threads — so it turned amber at load 32 and red at 48 while the watchdog did not reach soft pressure until 64 or medium until 96. A page whose whole job is reporting what the watchdogs think was reporting a crisis about a machine they considered idle. The remote path already sent the partner's own nproc, so both nodes now agree.
This commit is contained in:
@@ -222,7 +222,20 @@ function vv_wd_local_system(): array {
|
||||
$loadRaw = @file_get_contents('/proc/loadavg') ?: '0';
|
||||
$daemonOk = (trim(shell_exec('docker info >/dev/null 2>&1; echo $?') ?: '1') === '0');
|
||||
$oomCount = (int)trim(@file_get_contents(STATE_DIR . '/system_watchdog_oom.db') ?: '0');
|
||||
$cores = (int)($sys['cpu_cores'] ?: (int)(trim(shell_exec('nproc 2>/dev/null') ?: '1')));
|
||||
// nproc first, and cpu_cores only as a fallback — the reverse of what this used to do.
|
||||
//
|
||||
// The page draws its load bar and colours against this number multiplied by the same
|
||||
// RW_LOAD_* multipliers resource_watchdog.sh uses, and that script computes its thresholds
|
||||
// from `nproc` (resource_watchdog.sh:194). cpu_cores is the API's physical core count: 16 here
|
||||
// against 32 threads. Preferring it made the page turn amber at load 32 and red at 48 while
|
||||
// the watchdog did not reach soft pressure until 64 and medium until 96 — the page reporting
|
||||
// a crisis about a subsystem that considered the machine idle, which is the one thing a page
|
||||
// whose entire job is showing what the watchdogs think must not do.
|
||||
//
|
||||
// Whether load should be judged against threads or cores is a real argument; it is not this
|
||||
// file's argument to have. The number here has to be the number the actor used, or the page
|
||||
// is describing a different machine.
|
||||
$cores = (int)(trim(shell_exec('nproc 2>/dev/null') ?: '') ?: ($sys['cpu_cores'] ?: 1));
|
||||
return [
|
||||
'mem_total' => (int)($mem['total_kb'] * 1024),
|
||||
'mem_avail' => (int)($mem['free_kb'] * 1024),
|
||||
|
||||
Reference in New Issue
Block a user