- Umgebungsvariablen klar getrennt: .env.development für dev, .env.production für Build - Verhindert versehentliche Verwendung von .env.local bei next build - Build-Umgebung verwendet jetzt korrekt .env.production
26 lines
781 B
JavaScript
26 lines
781 B
JavaScript
import { store } from "@/redux/store";
|
|
import { updateHeap } from "@/redux/slices/heapMonitorSlice";
|
|
|
|
export const monitorHeapAndReload = (limitInGB = 8, intervalMs = 10000) => {
|
|
const limit = limitInGB * 1024 * 1024 * 1024;
|
|
|
|
return setInterval(() => {
|
|
const heap = performance.memory?.usedJSHeapSize || 0;
|
|
|
|
//console.log("Heap:", (heap / 1024 / 1024).toFixed(2), "MB");
|
|
|
|
if (heap > limit) {
|
|
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);
|
|
};
|