On Wednesday, 14 November 2012 23:43:27 UTC, Forrest L Norvell wrote: > > > > Forrest L Norvell > Node.js agent engineer > | E [email protected] <javascript:> | C (415) 823-6356 | T > @othiym23<http://twitter.com/othiym23> > | G github.com/othiym23 | W newrelic.com > *(* *(* **)**)* *New Relic* > > On Wednesday, November 14, 2012 at 3:36 PM, pie_lard wrote: > > If the modules aren't patched to be domain-aware, then there's no way to > ensure that the callback is evaluated in the correct domain. How do you > think that would work? > > > To use my particular example - I've got a pool of node-mysql connections. > Ultimately node-mysql is built on top of the node network socket API so > anytime a connection object fires a query off to the database it's doing so > with a low-level call to part of the node API - in the same way as > fs.read() or anything else. If domains can persist when I just call > fs.read() or process.nextTick() - without having done any domain.add()s - > then they should also work when node-mysql does a network call. > > How does that persistence work? Put differently, how is Node supposed to > know when a given EE is participating in a domain? You and I know that each > individual node-mysql connection only handles a single query / response at > a time, but other modules are going to multiplex on event emitters, and > then you have to deal with the problem of figuring out which callback to > associate with which domain. > > F > > So, for example, node-mysql could be receiving callbacks because data has arrived on a socket (or something like that - haven't looked and haven't done any low-level IO in node ;) ). And perhaps that data may turn out to be part of the response to one of several in-flight queries (this is all hypothetical). So I guess node-mysql would in that case have to track domains itself - that is, when query() is called by end-user code it would have to store the value of process.domain along with whatever it needs to track the call.
My point is that (a) that still doesn't involve binding a node-mysql connection to a particular domain, which wouldn't help afaict and (b) many modules presumably wouldn't have to do this if they aren't multiplexing results in this way (I guess most aren't). Sorry if this is all getting a bit long-winded. I think I'm getting my head around domains anyway! -- 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
