about summary refs log tree commit homepage
path: root/lib/rainbows/http_server.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-04-09 18:58:23 -0700
committerEric Wong <normalperson@yhbt.net>2011-04-21 14:50:03 -0700
commit63b3b40abf054bce2846bc9e36770a6ed2791a8b (patch)
treec027c6d38a41763a5bfeb63d208673050aefced6 /lib/rainbows/http_server.rb
parent066bbf930d023ecf61ed4af363aebadbce2c51db (diff)
downloadrainbows-63b3b40abf054bce2846bc9e36770a6ed2791a8b.tar.gz
Might as well, threads are free and cheap on 64-bit
Diffstat (limited to 'lib/rainbows/http_server.rb')
-rw-r--r--lib/rainbows/http_server.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/rainbows/http_server.rb b/lib/rainbows/http_server.rb
index 21c5a05..02f3405 100644
--- a/lib/rainbows/http_server.rb
+++ b/lib/rainbows/http_server.rb
@@ -52,6 +52,13 @@ class Rainbows::HttpServer < Unicorn::HttpServer
     # 5: std{in,out,err} + heartbeat FD + per-process listener
     nofile = 5 + @worker_connections + LISTENERS.size
     trysetrlimit(:RLIMIT_NOFILE, nofile)
+
+    case @use
+    when :ThreadSpawn, :ThreadPool, :ActorSpawn,
+         :CoolioThreadSpawn, :RevThreadSpawn,
+         :WriterThreadPool, :WriterThreadSpawn
+      trysetrlimit(:RLIMIT_NPROC, @worker_connections + LISTENERS.size + 1)
+    end
     super
   end