The work done in the new domain involves async callbacks (sometimes 
multiple levels of them.)  They preserve the current domain (via the 
eventing system), but not the entire stack.

On Wednesday, August 1, 2012 12:10:53 AM UTC-7, Isaac Schlueter wrote:
>
> MikeS, 
>
> Why can't you just create the new domain, enter it, do the stuff, then 
> exit it, and do the rest? 
>
> When you enter/exit domains, it's a stack.  So, when you exit one 
> domain, you're back in the original one. 
>
> On Tue, Jul 31, 2012 at 5:18 PM, MikeS  wrote: 
> >> Something I've found useful, just in the error handling, umm, domain, 
> when 
> >> processing a set of work that will result in asynchronous callbacks 
> (e.g. 
> >> web service calls) is to 
> > 
> > 
> > Save off the current domain, which is the one associated with some HTTP 
> > request. 
> > Create a new domain 
> > Do all the work under the control of the domain created in 2, which will 
> > process any errors 
> > When all the work is done, process the resulting data (including any 
> errors) 
> > under the control of the domain saved in step 1. 
> > 
> > Being able to use process.domain in step 1 is crucial. 
>

Reply via email to