about summary refs log tree commit homepage
path: root/lib/rainbows/pool_size.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-05-09 00:17:06 +0000
committerEric Wong <normalperson@yhbt.net>2011-05-09 00:17:06 +0000
commit725adcc6986bc2658d92ea3ebebe61d2b83060ad (patch)
treedcaa850fc3a329e98dd420083105421cabfc5295 /lib/rainbows/pool_size.rb
parent3c1649226d2371ce09d14f3fcce18fec0af1ba02 (diff)
downloadrainbows-725adcc6986bc2658d92ea3ebebe61d2b83060ad.tar.gz
coolio_thread_pool, neverblock both use it, and
xepoll_thread_pool will support it next, too.
Diffstat (limited to 'lib/rainbows/pool_size.rb')
-rw-r--r--lib/rainbows/pool_size.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/rainbows/pool_size.rb b/lib/rainbows/pool_size.rb
new file mode 100644
index 0000000..8089869
--- /dev/null
+++ b/lib/rainbows/pool_size.rb
@@ -0,0 +1,14 @@
+# -*- encoding: binary -*-
+# :stopdoc:
+module Rainbows::PoolSize
+  DEFAULTS = {
+    :pool_size => 50, # same as the default worker_connections
+  }
+
+  def setup
+    o = Rainbows::O
+    DEFAULTS.each { |k,v| o[k] ||= v }
+    Integer === o[:pool_size] && o[:pool_size] > 0 or
+      raise ArgumentError, "pool_size must a be an Integer > 0"
+  end
+end