[Groonga-commit] droonga/droonga-engine at 66416df [master] Shutdown Serf out of signal handler

Back to archive index

Kouhei Sutou null+****@clear*****
Thu May 22 13:02:49 JST 2014


Kouhei Sutou	2014-05-22 13:02:49 +0900 (Thu, 22 May 2014)

  New Revision: 66416df368d946f5a259921e6140c3c7d39c0a24
  https://github.com/droonga/droonga-engine/commit/66416df368d946f5a259921e6140c3c7d39c0a24

  Message:
    Shutdown Serf out of signal handler

  Modified files:
    lib/droonga/command/droonga_engine.rb

  Modified: lib/droonga/command/droonga_engine.rb (+6 -6)
===================================================================
--- lib/droonga/command/droonga_engine.rb    2014-05-22 12:55:27 +0900 (2f21010)
+++ lib/droonga/command/droonga_engine.rb    2014-05-22 13:02:49 +0900 (61c6150)
@@ -193,19 +193,15 @@ module Droonga
         def run_main_loop
           raw_loop = Coolio::Loop.default
 
-          serf = nil
           service_runner = nil
           trap(:INT) do
-            serf.shutdown if serf
             service_runner.stop_immedieate if service_runner
             raw_loop.stop
           end
           trap(Signals::GRACEFUL_STOP) do
-            serf.shutdown if serf
             service_runner.stop_graceful if service_runner
           end
           trap(Signals::IMMEDIATE_STOP) do
-            serf.shutdown if serf
             service_runner.stop_immediate if service_runner
             raw_loop.stop
           end
@@ -223,8 +219,12 @@ module Droonga
           end
 
           serf = run_serf(raw_loop)
-          service_runner = run_service(raw_loop)
-          raw_loop.run
+          begin
+            service_runner = run_service(raw_loop)
+            raw_loop.run
+          ensure
+            serf.shutdown
+          end
 
           service_runner.success?
         end
-------------- next part --------------
HTML����������������������������...
Télécharger 



More information about the Groonga-commit mailing list
Back to archive index