From 4e42b60205ebb2ead8535e77658ccffb206346f1 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 15 Oct 2015 01:37:33 +0000 Subject: speed up QUIT for users of the unicorn worker_loop WriterThreadPool, WriterThreadSpawn, Base, and potentially other rarely-used concurrency options experienced slow shutdowns due to the destruction of a listener socket failing to wake up a thread in IO.select. Send ourselves a signal to interrupt the IO.select call in the main thread to force the wakeup. --- lib/rainbows.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/rainbows.rb b/lib/rainbows.rb index 3bebf34..0af5620 100644 --- a/lib/rainbows.rb +++ b/lib/rainbows.rb @@ -93,6 +93,9 @@ module Rainbows @readers.clear tmp.each { |s| s.close rescue nil }.clear @at_quit.each { |task| task.call } + + # XXX hack to break out of IO.select in worker_loop for some models + Process.kill(:QUIT, $$) end false end -- cgit v1.2.3-24-ge0c7