lib/rainbows/never_block.rb in rainbows-0.94.0 vs lib/rainbows/never_block.rb in rainbows-0.95.0
- old
+ new
@@ -16,27 +16,28 @@
# worker_connections 100
# end
#
module NeverBlock
+ # :stopdoc:
DEFAULTS = {
:pool_size => 20, # same default size used by NB
:backend => :EventMachine, # NeverBlock doesn't support Rev yet
}
# same pool size NB core itself uses
- def self.setup
+ def self.setup # :nodoc:
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"
mod = Rainbows.const_get(O[:backend])
require "never_block" # require EM first since we need a higher version
G.server.extend(mod)
G.server.extend(Core)
end
- module Core
+ module Core # :nodoc: all
def self.setup
self.const_set(: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}"
Rainbows::NeverBlock.const_get(:Client).class_eval do
@@ -55,17 +56,17 @@
rescue => e
handle_error(e)
end
end
end
- end
- module Core
def init_worker_process(worker)
super
Core.setup
logger.info "NeverBlock/#{O[:backend]} pool_size=#{O[:pool_size]}"
end
end
+
+ # :startdoc:
end
end