♻️ 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:
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user