♻️ Refactor: cleanupMarkers util eingeführt für alle Marker-Typen + Feature: Heap-Memory-Monitoring über Redux-Slice mit Auto-Reload bei >8GB

This commit is contained in:
ISA
2025-06-06 11:36:06 +02:00
parent 1ec0a8a611
commit 51d2d58f8e
6 changed files with 67 additions and 2 deletions

View File

@@ -1,3 +1,6 @@
import { store } from "@/redux/store";
import { updateHeap } from "@/redux/slices/heapMonitorSlice";
export const monitorHeapAndReload = (limitInGB = 8, intervalMs = 10000) => {
const limit = limitInGB * 1024 * 1024 * 1024;
@@ -7,8 +10,16 @@ export const monitorHeapAndReload = (limitInGB = 8, intervalMs = 10000) => {
console.log("Heap:", (heap / 1024 / 1024).toFixed(2), "MB");
if (heap > limit) {
console.warn("🚨 Heap-Limit erreicht. Reload wird ausgeführt.");
//console.warn("🚨 Heap-Limit erreicht. Reload wird ausgeführt.");
location.reload();
}
store.dispatch(updateHeap(heap));
}, intervalMs);
};
export const monitorHeapWithRedux = (intervalMs = 10000) => {
return setInterval(() => {
const heap = performance.memory?.usedJSHeapSize || 0;
store.dispatch(updateHeap(heap));
}, intervalMs);
};