Wait till all node_helper are started before finishing startup (#2928)

In response to #2487 this implements a Promise.all for the node_helper
start calls

Co-authored-by: veeck <michael@veeck.de>
This commit is contained in:
Veeck
2022-10-13 21:38:04 +02:00
committed by GitHub
parent 1eb2965b2b
commit 7bbf8c19db
2 changed files with 10 additions and 5 deletions

View File

@@ -226,17 +226,21 @@ function App() {
httpServer = new Server(config, function (app, io) {
Log.log("Server started ...");
const nodePromises = [];
for (let nodeHelper of nodeHelpers) {
nodeHelper.setExpressApp(app);
nodeHelper.setSocketIO(io);
nodeHelper.start();
nodePromises.push(nodeHelper.start());
}
Log.log("Sockets connected & modules started ...");
Promise.allSettled(nodePromises).then(() => {
Log.log("Sockets connected & modules started ...");
if (typeof callback === "function") {
callback(config);
}
if (typeof callback === "function") {
callback(config);
}
});
});
});
});