Hi Eric, Not that it really matters to me, but I thought I let you know, just in case you think it does matter: after sending a WINCH should you decide to send TTINs then that has no effect. ( whereas if you dropped slowly by sending TTOUs, then when it reaches 0 workers you can still send TTINs ) Cheers, Lawrence
Lawrence Pit <lawrence.pit at gmail.com> wrote:> Hi Eric, > > Not that it really matters to me, but I thought I let you know, just in > case you think it does matter: after sending a WINCH should you decide > to send TTINs then that has no effect. ( whereas if you dropped slowly > by sending TTOUs, then when it reaches 0 workers you can still send TTINs > )Hi Lawrence, thanks for noticing this. Apparently nobody did before :) The following patch *should* work (untested). I''ll write a proper test case later today if nobody beats me to it. diff --git a/lib/unicorn.rb b/lib/unicorn.rb index c231a4d..8f490bb 100644 --- a/lib/unicorn.rb +++ b/lib/unicorn.rb @@ -423,10 +423,12 @@ module Unicorn respawn = false logger.info "gracefully stopping all workers" kill_each_worker(:QUIT) + self.worker_processes = 0 else logger.info "SIGWINCH ignored because we''re not daemonized" end when :TTIN + respawn = true self.worker_processes += 1 when :TTOU self.worker_processes -= 1 if self.worker_processes > 0 -- Eric Wong
Hi Eric, Confirmed. Works for me. Lawrence>> Not that it really matters to me, but I thought I let you know, just in >> case you think it does matter: after sending a WINCH should you decide >> to send TTINs then that has no effect. ( whereas if you dropped slowly >> by sending TTOUs, then when it reaches 0 workers you can still send TTINs >> ) >> > > Hi Lawrence, thanks for noticing this. Apparently nobody did before :) > The following patch *should* work (untested). > > I''ll write a proper test case later today if nobody beats me to it. > > diff --git a/lib/unicorn.rb b/lib/unicorn.rb > index c231a4d..8f490bb 100644 > --- a/lib/unicorn.rb > +++ b/lib/unicorn.rb > @@ -423,10 +423,12 @@ module Unicorn > respawn = false > logger.info "gracefully stopping all workers" > kill_each_worker(:QUIT) > + self.worker_processes = 0 > else > logger.info "SIGWINCH ignored because we''re not daemonized" > end > when :TTIN > + respawn = true > self.worker_processes += 1 > when :TTOU > self.worker_processes -= 1 if self.worker_processes > 0 >