hijacking support for Rack 1.5.x users
[rainbows.git] / lib / rainbows / never_block / core.rb
blob611b3c3dc5f44a7d50d04c3a63cc549db9b3b5e5
1 # -*- encoding: binary -*-
2 # :enddoc:
3 module Rainbows::NeverBlock::Core
4   def init_worker_process(worker)
5     super
6     o = Rainbows::O
7     pool = NB::Pool::FiberPool.new(o[:pool_size])
8     base = o[:backend].to_s.gsub!(/([a-z])([A-Z])/, '\1_\2').downcase!
9     require "rainbows/never_block/#{base}"
10     client_class = Rainbows::NeverBlock::Client
11     client_class.superclass.const_set(:APP, Rainbows.server.app)
12     client_class.const_set(:POOL, pool)
13     logger.info "NeverBlock/#{o[:backend]} pool_size=#{o[:pool_size]}"
14   end
15 end