about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-03-01 14:43:04 -0800
committerEric Wong <normalperson@yhbt.net>2009-03-03 11:13:12 -0800
commit723254df772154e2790b26923d4827a096c53428 (patch)
tree4f790b95a910e3f379dd5199341bd877c4f7e6ae /lib
parent9a7e1f1a7e986a59eb4be9b6a4d093f3366c9c72 (diff)
downloadunicorn-723254df772154e2790b26923d4827a096c53428.tar.gz
Some applications do not handle loading before forking
out-of-the-box very gracefully, this starts adding support
to build the Rack(-ish) application later in the process.
Diffstat (limited to 'lib')
-rw-r--r--lib/unicorn.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index aad4c3d..fa2ebe8 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -86,6 +86,7 @@ module Unicorn
       config_listeners.each { |addr| listen(addr) }
       listen(Const::DEFAULT_LISTENER) if @listeners.empty?
       self.pid = @config[:pid]
+      build_app!
       spawn_missing_workers
       self
     end
@@ -529,5 +530,9 @@ module Unicorn
       listeners.map { |io| sock_name(io) }
     end
 
+    def build_app!
+      @app = @app.call if @app.respond_to?(:arity) && @app.arity == 0
+    end
+
   end
 end