I am very intrigued with the idea of domains.  It is my understanding that 
domain.active will be a single variable that will be available throughout 
the handling of a single request.  If this is correct, I could stuff a few 
vars into domain.active and then not have to program the tedious process of 
passing around req, res, and others through scores (!) of asynchronous 
calls.

Starting to work with domains I have this:

var reqd = domain.create();
reqd.add(req);
reqd.add(res);

reqd.run(function() {
  ... lots of async.X calls in here, through multiple files
});

What I'm finding is as soon as run exits, the domain goes away.  Is it 
possible to, say, get a "next" out of the run() command that I can call 
when all my asynchronous work is done, instead of having the domain 
disappear at the end of run()?

I have a feeling I'm using domains entirely wrong.  

My goal is to have a pool of MySQL connections and then associate a single 
connection with all of a request's queries.  My idea was to stuff just a 
single connection in to domain.active and then rainbows and unicorns would 
magically come prancing out of my app.  :-)  But that does not seem to be 
the case.  Unfortunately.

Thank you!

PS - Do I really have to wrap every single function call in d.bind()?  That 
seems like a lot of work.

-- 
-- 
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to