> So, how do I get the function to be asynchronous

You can't.  You could put in setTimeouts with zero delay if you are worried
about giving other tasks a chance of running more often.

> I just do not get the threading aspect of it all

It is actually simple, there is not threading.  You can launch other
processes if you wish.

What evidence do you have that the running time of your code is a problem
for your application?  How many milliseconds does it consume?  Are you
prematurely optimizing?


On Sun, Jun 16, 2013 at 3:26 PM, Robert Steckroth <[email protected]
> wrote:

> So, how do I get the function to be asynchronous if I added other
> functionality? Is there a module to import? I just do not get the threading
> aspect of it all I guess.
>
>
> On Sun, Jun 16, 2013 at 4:37 PM, Angel Java Lopez 
> <[email protected]>wrote:
>
>> Hi!
>>
>> Ummm... makeXmlFromString, beginning at line 83, could directly return
>> the value xmlFile instead of calling a callback. No I/O in its body, so you
>> don't leverage the power of node.js to manage async I/O
>>
>> Maybe, at line 61, when req.on('data'....) you could start to create the
>> xml, incrementally. But if it is hard, that's ok, for a first approach
>>
>> Any comments?
>>
>> Angel "Java" Lopez
>> @ajlopez
>>
>>
>>
>> On Sun, Jun 16, 2013 at 5:27 PM, Robert Steckroth <
>> [email protected]> wrote:
>>
>>> I have a server which parses through a text file and creates a XML page.
>>>
>>> The XML creation can involve a lot of loops (up to ~8000).
>>>
>>> I am confused regarding the asynchronous nature of NodeJs.
>>>
>>> Would the below function benefit from a non-blocking call? Or does the 
>>> createServer function maintain its own thread for each incoming request?
>>>
>>>
>>> You can see this function call on line: 65 of the provided Node file.
>>>
>>> makeXmlFromString(textOutput, function(xmlText)
>>>
>>>
>>> http://bazaar.launchpad.net/~robertsteckroth/stock-ticker-mobile-app/proxy/view/head:/server/stock_proxy_server.js
>>>
>>>
>>>
>>>
>>> Or maybe this file is done correctly... I am having a lot of trouble 
>>> getting the scoop on async in JavaScript :0
>>>
>>> --
>>>
>>> Bust0ut, Surgemcgee: Systems/Web/Software Engineer
>>>
>>> "Freedom is empowered by those without power" - Robert Edward Steckroth
>>> II
>>> "Injustice, regarding the internet, is fashioned through laws and
>>> enforcement" - Robert Edward Steckroth II
>>> "Reality is the fuel of the universe and the roadblock to human
>>> understanding" - Robert Edward Steckroth II
>>>
>>>
>>>  --
>>> --
>>> 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.
>>>
>>>
>>>
>>
>>  --
>> --
>> 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.
>>
>>
>>
>
>
>
> --
> Bust0ut, Surgemcgee: Systems/Web/Software Engineer
>
> "Freedom is empowered by those without power" - Robert Edward Steckroth II
> "Injustice, regarding the internet, is fashioned through laws and
> enforcement" - Robert Edward Steckroth II
> "Reality is the fuel of the universe and the roadblock to human
> understanding" - Robert Edward Steckroth II
>
>
>  --
> --
> 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.
>
>
>

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