1 # -*- encoding: binary -*-
5 class HttpServer < ::Unicorn::HttpServer
12 @@instance.instance_eval(&block)
16 def initialize(app, options)
18 rv = super(app, options)
19 defined?(@use) or use(:Base)
20 @worker_connections ||= MODEL_WORKER_CONNECTIONS[@use]
24 model = args.shift or return @use
26 Rainbows.const_get(model)
28 raise ArgumentError, "concurrency model #{model.inspect} not supported"
32 raise ArgumentError, "concurrency model #{model.inspect} not supported"
34 Const::RACK_DEFAULTS['rainbows.model'] = @use = model
35 Const::RACK_DEFAULTS['rack.multithread'] = !!(/Thread/ =~ model.to_s)
38 def worker_connections(*args)
39 return @worker_connections if args.empty?
41 (Integer === nr && nr > 0) or
42 raise ArgumentError, "worker_connections must be a positive Integer"
43 @worker_connections = nr