From 38f6a92231c50cc8bdde3e67f51495eaecd12bd0 Mon Sep 17 00:00:00 2001 From: Evan Phoenix Date: Sun, 20 Mar 2016 14:14:35 -0700 Subject: [PATCH] Speed up phased-restart start --- lib/puma/cluster.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/puma/cluster.rb b/lib/puma/cluster.rb index f9c9cabb..a3920be5 100644 --- a/lib/puma/cluster.rb +++ b/lib/puma/cluster.rb @@ -424,12 +424,21 @@ module Puma @launcher.events.fire_on_booted! begin + force_check = false + while @status == :run begin - res = IO.select([read], nil, nil, 5) + if @phased_restart + start_phased_restart + @phased_restart = false + end + + check_workers force_check force_check = false + res = IO.select([read], nil, nil, 5) + if res req = read.read_nonblock(1) @@ -455,13 +464,6 @@ module Puma end end - if @phased_restart - start_phased_restart - @phased_restart = false - end - - check_workers force_check - rescue Interrupt @status = :stop end