You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to the current implementation of the boot process using this invocation style:
javascript
module.exports = function someBootScript(app) {
// Init models, ...
// Setup relationships
// Other async stuff
};
it is currently not really possible (in a clean way) to have loopback wait with accepting requests until complete finalisation of the boot process. Some asynchronous operations may not yet have finished.
Please adjust this to something like:
module.exports=functionsomeAsyncBootScript(app,done){// Init models, ...// Setup relationships// Other async stuff that calls done() when ready.};
And only start the listener after this... It should be fairly easy to implement this using Q.all()...
Due to the current implementation of the boot process using this invocation style:
javascript
module.exports = function someBootScript(app) {
// Init models, ...
// Setup relationships
// Other async stuff
};
it is currently not really possible (in a clean way) to have loopback wait with accepting requests until complete finalisation of the boot process. Some asynchronous operations may not yet have finished.
Please adjust this to something like:
module.exports = function someAsyncBootScript(app, done) {
// Init models, ...
// Setup relationships
// Other async stuff that calls done() when ready.
};
And only start the listener after this... It should be fairly easy to implement this using Q.all()...
—
Reply to this email directly or view it on GitHub.
Activity
raymondfeng commentedon Aug 5, 2014
The boot() is designed to be synchronous at the moment. We’re open to make it more flexible.
Thanks,
Raymond Feng
Co-Founder and Architect @ StrongLoop, Inc.
StrongLoop makes it easy to develop APIs in Node, plus get DevOps capabilities like monitoring, debugging and clustering.
On Aug 5, 2014, at 12:09 PM, Daan Kets notifications@github.com wrote:
bajtos commentedon Oct 14, 2014
#50 implemented support for async boot scripts, the feature is available as of
v2.1.0.