about summary refs log tree commit homepage
path: root/lib/rainbows/http_server.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-11-05 18:30:28 -0800
committerEric Wong <normalperson@yhbt.net>2009-11-05 18:32:08 -0800
commite1dcadef6ca242e36e99aab19e3e040bf01070f9 (patch)
tree8217e9e72ee970caef763ef1b58bfae656e742b8 /lib/rainbows/http_server.rb
parentca2cb5d9faeeeb28314c3d04a042dfd915552488 (diff)
downloadrainbows-e1dcadef6ca242e36e99aab19e3e040bf01070f9.tar.gz
Loading TeeInput or HttpResponse late does not always work well
in multithreaded situations and have been causing random test
failures on heavily loaded multicore boxes.
Diffstat (limited to 'lib/rainbows/http_server.rb')
-rw-r--r--lib/rainbows/http_server.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/rainbows/http_server.rb b/lib/rainbows/http_server.rb
index c0877cd..7935105 100644
--- a/lib/rainbows/http_server.rb
+++ b/lib/rainbows/http_server.rb
@@ -47,7 +47,13 @@ module Rainbows
         raise ArgumentError, "concurrency model #{model.inspect} not supported"
       extend(mod)
       Const::RACK_DEFAULTS['rainbows.model'] = @use = model.to_sym
-      Const::RACK_DEFAULTS['rack.multithread'] = !!(/Thread/ =~ model.to_s)
+
+      if /Thread/ =~ model.to_s
+        Const::RACK_DEFAULTS['rack.multithread'] = true
+        # autoload/require is not thread-safe
+        Unicorn.constants.each { |x| Unicorn.const_get(x) }
+      end
+
       case @use
       when :Rev, :EventMachine
         Const::RACK_DEFAULTS['rainbows.autochunk'] = true