From 2cd9fa2cde3827bad6e816c63e87866a64dd3de8 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Mon, 13 Oct 2025 22:50:16 +0200 Subject: [PATCH] Only keep the last 120 stored stats (#1805) --- app/Filament/Server/Widgets/ServerConsole.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Filament/Server/Widgets/ServerConsole.php b/app/Filament/Server/Widgets/ServerConsole.php index e668ab96c..c6ba06314 100644 --- a/app/Filament/Server/Widgets/ServerConsole.php +++ b/app/Filament/Server/Widgets/ServerConsole.php @@ -121,11 +121,11 @@ class ServerConsole extends Widget foreach ($data as $key => $value) { $cacheKey = "servers.{$this->server->id}.$key"; - $data = cache()->get($cacheKey, []); + $cachedStats = cache()->get($cacheKey, []); - $data[$timestamp] = $value; + $cachedStats[$timestamp] = $value; - cache()->put($cacheKey, $data, now()->addMinute()); + cache()->put($cacheKey, array_slice($cachedStats, -120), now()->addMinute()); } }