-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wait till all node_helper are started before finishing startup #2928
Conversation
07e06da
to
32b11e0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two pieces of feedback:
- It might make sense to move the log line into the completion block, so that the message indicates when all modules have started rather than when all modules have been told to start. Or log in both places, to give some visibility into the time it takes for that to happen.
- Contrary to my original suggestion,
Promise.allSettled()
(Node 12.9+) might be more appropriate so that an error doesn't cause it to complete prematurely.
Thanks for the feedback @MikeBishop Now ready for real review ;-) |
Codecov Report
@@ Coverage Diff @@
## develop #2928 +/- ##
===========================================
+ Coverage 63.82% 64.06% +0.24%
===========================================
Files 9 9
Lines 293 295 +2
===========================================
+ Hits 187 189 +2
Misses 106 106
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about those that fail? are we expecting the module to alert the user somehow, and we say nothing? just thinking of debug
not sure how many module developers use async here at all .... |
well, none in the start function.. cause it doesn't exist.. i use both promises and async where appropriate |
a module developer could use async anyway, even if it is not used in the prototype method (just like the OP does). might be interesting to mention it in the docs for developers... |
FWIW, I wound up shipping mine using async anyway, and just putting the things that might take longer last. I haven't encountered any ill effects from my start-up routine completing a bit after the parent process thinks it did. But @sdetweil makes an interesting point. In the current design, if a module throws an exception during start-up, does the server start-up fail entirely? If that's the desired behavior, then |
Im currently on a trip, so no real way for me to check the current behaviour. |
Currently if a node_helper of a module throws an exception in the start method, all other node_helper after that dont get started due to: " As an example, use the default config and throw an exception in the newsfeed helper module. Calendar module wont start and show nothing... With the changes here that will still happen. Why? Because the start method doesnt return a promise, and we have no try/catch anywhere in the startup sequence. Do I like this behvior? No, since it confuses a user. If a module errors, only that module should error and not any other module that has nothing to do with it. Two ways to fix it:
Obviously 2) is a wishful thinking and would probably result in old modules that still work not being resilient. So I think 1) is the way to go. But since that doesnt have to happen here in this PR it can be done seperatly after this gets merged. Comments? |
yes, 2 is wonderful idea, but we have so many modules that are no longer maintained, this will never happen so it must be option 1. I personally hate that we have a fatal config error but continue to run with something else |
from my side this can be merged as it doesn't change the current state. For a future PR: option 1 ... |
Created a ticket for the error handling improvement: #2944 |
In response to #2487 this implements a Promise.all for the node_helper start calls. Just a draft becuase I want to get feedback first....