Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
46
rated 0 times [  48] [ 2]  / answers: 1 / hits: 16394  / 13 Years ago, sat, january 21, 2012, 12:00:00

If I have a simple setTimeout() function, and set it for 10 seconds...



The the entire server is dead inside those 10 seconds??? Is this true? That's what I heard.


More From » node.js

 Answers
17

The answer is no. What your link Node.js: How would you recreate the 'setTimeout' function without it blocking the event loop? showed was not a setTimeout blocking the event loop it was a while loop that deliberately blocks the event loop. If you want your server to be fast you do not want to block the event loop. An asynchronous callback such as setTimeout will work great.



Are you trying to block for some reason (like testing or something?)


[#87878] Friday, January 20, 2012, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
anjelicadixied

Total Points: 742
Total Questions: 94
Total Answers: 97

Location: Iraq
Member since Fri, Jun 5, 2020
4 Years ago
;