From 697763f3330beed84737bec44072c87d0c80b09c Mon Sep 17 00:00:00 2001 From: Myron Blair Date: Mon, 22 Jun 2026 04:52:04 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20wrap=20server=5Fstats=20INSERT=20in=20tr?= =?UTF-8?q?y/catch=20=E2=80=94=20SQLite=20lock=20was=20killing=20stats=20A?= =?UTF-8?q?PI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Concurrent cron writes (collect-stats.php every 5min) caused DB lock errors that aborted the entire stats response, leaving web/mail/FTP pages empty. History insert is now non-fatal. --- panel/api/endpoints/system.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/panel/api/endpoints/system.php b/panel/api/endpoints/system.php index 7cc6bcb..11b93ca 100644 --- a/panel/api/endpoints/system.php +++ b/panel/api/endpoints/system.php @@ -390,11 +390,13 @@ BASH; if ($active) $services[$svc] = $active; } - // Persist to DB for history - $db->execute( - "INSERT INTO server_stats (cpu_usage,ram_usage,disk_usage,load_avg) VALUES (?,?,?,?)", - [$cpuPct, $ramPct, $diskPct, $load[0]] - ); + // Persist to DB for history (non-fatal — don't let lock errors kill the stats response) + try { + $db->execute( + "INSERT INTO server_stats (cpu_usage,ram_usage,disk_usage,load_avg) VALUES (?,?,?,?)", + [$cpuPct, $ramPct, $diskPct, $load[0]] + ); + } catch (Throwable $_) {} Response::success([ 'cpu' => ['pct' => $cpuPct, 'load' => $load],