about summary refs log tree commit homepage
path: root/lib/rainbows/never_block/core.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rainbows/never_block/core.rb')
-rw-r--r--lib/rainbows/never_block/core.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/rainbows/never_block/core.rb b/lib/rainbows/never_block/core.rb
new file mode 100644
index 0000000..7188f75
--- /dev/null
+++ b/lib/rainbows/never_block/core.rb
@@ -0,0 +1,15 @@
+# -*- encoding: binary -*-
+# :enddoc:
+module Rainbows::NeverBlock::Core
+  def init_worker_process(worker)
+    super
+    o = Rainbows::O
+    pool = NB::Pool::FiberPool.new(o[:pool_size])
+    base = o[:backend].to_s.gsub!(/([a-z])([A-Z])/, '\1_\2').downcase!
+    require "rainbows/never_block/#{base}"
+    client_class = Rainbows::NeverBlock::Client
+    client_class.superclass.const_set(:APP, Rainbows::G.server.app)
+    client_class.const_set(:POOL, pool)
+    logger.info "NeverBlock/#{o[:backend]} pool_size=#{o[:pool_size]}"
+  end
+end