Fixed graph timeline bug

This commit is contained in:
2025-07-24 09:15:30 -05:00
parent 7f59a46881
commit 8e6d126324
+3 -3
View File
@@ -9,7 +9,7 @@ function average<T>(values: Array<T>, p: (v: T) => number) {
: 0;
}
const usageData = Array.from({length: 60}).map((_, i) => ({ hour: i, cpu: 0, ram: 0 }));
const usageData = new Array(60).fill({cpu: 0, ram: 0});
var i = 0;
setInterval(() => {
@@ -28,7 +28,7 @@ setInterval(() => {
};
i++;
}
}, 60000);
}, 1000);
export async function GET(request: Request) {
const { searchParams } = new URL(request.url);
@@ -47,7 +47,7 @@ export async function GET(request: Request) {
const maxRam = Math.max(...slice.map((entry) => entry.ram));
peakData.push({
hour: slice[0].hour,
hour: i,
cpu: maxCpu,
ram: maxRam
});