log GC duration and set to 10min interval

This commit is contained in:
HF 2022-04-04 22:52:45 +02:00
parent f6901823e6
commit cdf7a4a1d8
2 changed files with 4 additions and 1 deletions

View File

@ -3,7 +3,10 @@
*/
function forceGC() {
if (global.gc) {
const startTime = Date.now();
global.gc();
// eslint-disable-next-line no-console
console.log(`GC took ${Date.now() - startTime}`);
}
}

View File

@ -31,7 +31,7 @@ app.disable('x-powered-by');
// Call Garbage Collector every 30 seconds
setInterval(forceGC, 15 * 60 * SECOND);
setInterval(forceGC, 10 * 60 * SECOND);
// create http server
const server = http.createServer(app);