Hello all.
I'm create simple client for burst check web server:
var http = require("http");

var req_total = 10,
   req_per_sec = 30,
   i = 0;

var intervalID = setInterval(function timerik()  {
   i++;
   console.log(i); //write to console  task number
   console.time(i + ' latency');

    if(i == req_total){
       clearInterval(intervalID); //end of Life
   }

    http.get("http://www.yandex.ru";, function (response){
       console.log(i +" result = " + response.statusCode); //write to 
console task number and statusCode
       console.timeEnd(i +' latency'); //write to console operation timeout
   });

}, 1000/req_per_sec);

Result:
"C:\Program Files\nodejs\node.exe" run4.js
1
2
3
3 result = 200
3 latency: 24ms
4
4 result = 200
4 latency: 11ms
4 result = 200
4 latency: 43ms
5
6
6 result = 200
6 latency: 12ms
7
7 result = 200
7 latency: 8ms
8
9
10

Process finished with exit code 0

In this try i have two problems:
1) I lose few queries, In result you can see only 5 of 10 queries.
2) Few queries have not valid id. You can see them in result line 4.

How i can fix this problems?


-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/fbbb0d28-b52a-4261-b1de-49ea3774f7ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to