Skip to content

Commit

Permalink
Wait till all node_helper are started before finishing startup (#2928)
Browse files Browse the repository at this point in the history
In response to #2487 this implements a Promise.all for the node_helper
start calls

Co-authored-by: veeck <michael@veeck.de>
  • Loading branch information
rejas and veeck authored Oct 13, 2022
1 parent 1eb2965 commit 7bbf8c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Special thanks to: @rejas, @sdetweil
### Updated

- Cleaned up test directory
- Wait for all modules to start before declaring the system ready (#2487)
- Updated e2e tests (moved `done()` in helper functions) and use es6 syntax in all tests
- Updated da translation
- Rework weather module
Expand Down
14 changes: 9 additions & 5 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
});
});
});
Expand Down

0 comments on commit 7bbf8c1

Please sign in to comment.