-
Notifications
You must be signed in to change notification settings - Fork 33
Boot the app asynchronously #172
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| module.exports = function(app, cb) { | ||
| app.asyncBoot = typeof cb === 'function'; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does not really verify that the script are executed asynchronously. You should check that the boot process waits until the async scripts finished. I think you should rework the two new tests and merge them into one. // async.js
module.exports = function(app, cb) {
app.asyncBoot = typeof cb === 'function';
process.nextTick(cb);
}
// in the test
var app = require(...);
expect(app.booting, 'app.booting').to.be.true();
app.on('booted', function() {
expect(app.asyncBoot, 'app.asyncBoot').to.be.true();
done();
});
// the test will time out if `booted` is not emittedThoughts?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree. Merging into one simple script instead. |
||
| process.nextTick(cb); | ||
| }; | ||
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.
We must preserve the event
started, it's used by server/boot/explorer.js to print a message with Explorer URL, but only after the app was started.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.
Makes sense. It's different from
booted, adding back.