From cdf7a4a1d834c960c7ffaecb923ea504f11f863b Mon Sep 17 00:00:00 2001 From: HF Date: Mon, 4 Apr 2022 22:52:45 +0200 Subject: [PATCH] log GC duration and set to 10min interval --- src/core/forceGC.js | 3 +++ src/server.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/forceGC.js b/src/core/forceGC.js index 131cff8..30a193e 100644 --- a/src/core/forceGC.js +++ b/src/core/forceGC.js @@ -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}`); } } diff --git a/src/server.js b/src/server.js index 64d738f..efd15b5 100644 --- a/src/server.js +++ b/src/server.js @@ -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);