sorry, i'm such a noob, i'm just getting more confused. the working version 
of my code returns from the endmarker too soon, it doesn't wait for the 
db.create to complete which is what i need to slow down the reads from 
overwhelming the slow writes. 

Here in a nutshell is my revised code (which doesn't compile :-(  but 
hopefully it better confers what I'm trying to achieve in terms of code 
execution order....

1) endmarker event received
2) writetoDB
3) db.create
4) db.create completes
5 writetoDB completes
6 return from endmarker



            var xml = new XmlStream(response, 'utf8');

            xml.on('endElement: endmarker ', function writetoDB(input, 
callback){
                console.log('i want to return from here last after calling 
'writetoDB' and completing db.create');
            });

        function writetoDB(input, callback) {
            console.log('i want to arrive here first upon receipt of the 
xml endmarker');
            db.create(input, function(){
                console.log('create complete');
                console.log('action this second');
                callback();
            });  
        }

-- 
-- 
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