about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2017-03-13 08:28:54 -0700
committerEric Wong <e@80x24.org>2017-03-13 19:11:27 +0000
commitd0afe48696a643a5d7400b3db1d68cfd81e8cd38 (patch)
tree45628f8dd1abe65f121767465b8761c8fac3ad15
parentea1a4360d66a833d75fbd887388d8cd4fe4ae299 (diff)
This reduces the stack depth, making GC more efficient.
-rw-r--r--lib/unicorn/http_server.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index a5bd2c4..40a154d 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -541,14 +541,12 @@ class Unicorn::HttpServer
       worker = Unicorn::Worker.new(worker_nr)
       before_fork.call(self, worker)
 
-      pid = if @worker_exec
-        worker_spawn(worker)
-      else
-        fork do
-          after_fork_internal
-          worker_loop(worker)
-          exit
-        end
+      pid = @worker_exec ? worker_spawn(worker) : fork
+
+      unless pid
+        after_fork_internal
+        worker_loop(worker)
+        exit
       end
 
       @workers[pid] = worker