mirror of
https://github.com/pelican-dev/panel.git
synced 2025-10-29 22:36:51 +01:00
Only keep the last 120 stored stats (#1805)
This commit is contained in:
parent
d735e858a2
commit
2cd9fa2cde
@ -121,11 +121,11 @@ class ServerConsole extends Widget
|
|||||||
|
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
$cacheKey = "servers.{$this->server->id}.$key";
|
$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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user