Domains are useful to categorize and debug the error, even if you shutdown, don't just throw them away.
For performance starved JS (talking working under 50MB in a production area) idempotentcy / stateless arch generally results in memory usage or offloading to a single authority. Single authority requires well thought out recovery if the app dies from something bad happening. Statelessness if in a resource constrained system that cannot offload to say a remote DB is just going to be a TON of book keeping and memory management in JS is difficult to predict (generally we move to C/C++ at that point). Promises vs nested branch (sans q): ``` //make a promise to start the workflow onuser=db.getUser(x) //branch 1 onuser.then(db.isUserActive) //branch 2 ongroups= onuser.then(db.getGroupsForUser) //branch 2.1 ongroups.then(db.getPermForGroups.bind(db, 'dotask')) //branch 2.2 ongroups.then(db.getGroupsActive) ongroups.fail(onuser.fail.bind(onuser)) //branch 3 onuser.then(db.getPermForUser.bind(db, 'dotask')) //join // don't feel like writing the .then joins by hand... onuser.fail(joined.fail.bind(joined)) joined.then(win).fail(blah) ``` With Q fixing the anger; to look a lot like async.parallel ``` onuser=db.getUser(x) onuser.then(Q.all([ db.isUserActive, db.getGroupsForUser.then(Q.all([ db.getPermForGroups.bind(db, 'dotask'), db.getGroupsActive ])) db.getPermForUser.bind(db, 'dotask') ])).then(win).fail(blah) ``` -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.