From 3c514dff3a18cc71c70bc622c20a4658a3b1cf09 Mon Sep 17 00:00:00 2001 From: Karsten Hassel Date: Mon, 18 May 2026 21:02:14 +0200 Subject: [PATCH] fix systeminformation thread not ending (#4155) This was introduced when running systeminformation in an own thread. If the main thread ends before (e.g. when config has errors) the systeminformation thread never ends. As this can have side effects under pm2 or docker (because the app never exits) this PR restores the old behavior. --- js/app.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/js/app.js b/js/app.js index f37047fb..e2089170 100644 --- a/js/app.js +++ b/js/app.js @@ -328,6 +328,20 @@ function App () { await this.stop(); process.exit(0); }); + + /** + * + * @param {number} ms milliseconds to wait + */ + function blockingSleep (ms) { + const int32 = new Int32Array(new SharedArrayBuffer(4)); + Atomics.wait(int32, 0, 0, ms); + } + + process.on("exit", () => { + // wait before exiting so that child processes (e.g. systeminformation) have some additional time + blockingSleep(1000); + }); } module.exports = new App();