diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2010-10-27 02:10:14 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-10-27 02:12:25 -0700 |
commit | ac54272218a4d82f486aa163369962c98ba614c2 (patch) | |
tree | 9e566b71d651bd17a891bce89341f516d64a3b6a /benchmark | |
parent | 79ecc8e9b7f82b5159e04a42118f6d8b87dee2ee (diff) | |
download | node-ac54272218a4d82f486aa163369962c98ba614c2.tar.gz |
Gracefully handle EMFILE
Implementing a tip from Marc Lehmann:
http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#The_special_problem_of_accept_ing_wh
Keep an extra FD around for every server. When you hit EMFILE, destroy that
FD, accept a connection, close it; in this way you can clear the connection
queue and let people know that you're overload.
No more timeout needed.
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/idle_clients.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/benchmark/idle_clients.js b/benchmark/idle_clients.js index edeb641ac..9bb786280 100644 --- a/benchmark/idle_clients.js +++ b/benchmark/idle_clients.js @@ -17,7 +17,7 @@ function connect () { s.on('close', function () { if (gotConnected) connections--; - if (!haderror) connect(); + //if (!haderror) connect(); }); s.on('end', function () { @@ -36,6 +36,9 @@ connect(); var oldConnections, oldErrors; +// Try to start new connections every so often +setInterval(connect, 5000); + setInterval(function () { if (oldConnections != connections) { oldConnections = connections; |