[Groonga-commit] droonga/droonga-engine at 6b27b72 [master] Output "done" trace log after graceful operations are finished

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Apr 23 19:04:58 JST 2015


YUKI Hiroshi	2015-04-23 19:04:58 +0900 (Thu, 23 Apr 2015)

  New Revision: 6b27b72e4b23fb3b10fa95540783691d50bfa7d0
  https://github.com/droonga/droonga-engine/commit/6b27b72e4b23fb3b10fa95540783691d50bfa7d0

  Message:
    Output "done" trace log after graceful operations are finished

  Modified files:
    lib/droonga/dispatcher.rb
    lib/droonga/engine.rb
    lib/droonga/farm.rb
    lib/droonga/slice.rb

  Modified: lib/droonga/dispatcher.rb (+5 -3)
===================================================================
--- lib/droonga/dispatcher.rb    2015-04-23 18:40:09 +0900 (0367d02)
+++ lib/droonga/dispatcher.rb    2015-04-23 19:04:58 +0900 (42824b3)
@@ -72,7 +72,7 @@ module Droonga
       @farm.start
     end
 
-    def stop_gracefully(&on_stop)
+    def stop_gracefully(&block)
       logger.trace("stop_gracefully: start")
       @collector_runners.each_value do |collector_runner|
         collector_runner.shutdown
@@ -80,8 +80,10 @@ module Droonga
       @adapter_runners.each_value do |adapter_runner|
         adapter_runner.shutdown
       end
-      @farm.stop_gracefully(&on_stop)
-      logger.trace("stop_gracefully: done")
+      @farm.stop_gracefully do
+        yield
+        logger.trace("stop_gracefully: done")
+      end
     end
 
     def stop_immediately

  Modified: lib/droonga/engine.rb (+1 -1)
===================================================================
--- lib/droonga/engine.rb    2015-04-23 18:40:09 +0900 (1555e15)
+++ lib/droonga/engine.rb    2015-04-23 19:04:58 +0900 (c5b298b)
@@ -84,8 +84,8 @@ module Droonga
         @dispatcher.stop_gracefully do
           @state.shutdown
           yield
+          logger.trace("stop_gracefully/on_finish: done")
         end
-        logger.trace("stop_gracefully/on_finish: done")
       end
       if****@state*****_session?
         logger.trace("stop_gracefully/having sessions")

  Modified: lib/droonga/farm.rb (+10 -0)
===================================================================
--- lib/droonga/farm.rb    2015-04-23 18:40:09 +0900 (5fd26f1)
+++ lib/droonga/farm.rb    2015-04-23 19:04:58 +0900 (975919c)
@@ -15,11 +15,13 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
+require "droonga/loggable"
 require "droonga/deferrable"
 require "droonga/slice"
 
 module Droonga
   class Farm
+    include Loggable
     include Deferrable
 
     class NoSlice < StandardError
@@ -65,9 +67,11 @@ module Droonga
     end
 
     def stop_gracefully
+      logger.trace("stop_gracefully: start")
       n_slices =****@slice*****
       if n_slices.zero?
         yield if block_given?
+        logger.trace("stop_gracefully: done")
         return
       end
 
@@ -77,6 +81,7 @@ module Droonga
           n_done_slices += 1
           if n_done_slices == n_slices
             yield if block_given?
+            logger.trace("stop_gracefully: done")
           end
         end
       end
@@ -100,5 +105,10 @@ module Droonga
       end
       @slices[slice_name].process(message)
     end
+
+    private
+    def log_tag
+      "farm"
+    end
   end
 end

  Modified: lib/droonga/slice.rb (+1 -1)
===================================================================
--- lib/droonga/slice.rb    2015-04-23 18:40:09 +0900 (070ad9f)
+++ lib/droonga/slice.rb    2015-04-23 19:04:58 +0900 (06d51f2)
@@ -50,6 +50,7 @@ module Droonga
         @job_pusher.shutdown
         @processor.shutdown
         yield if block_given?
+        logger.trace("stop_gracefully: done")
       end
       if @supervisor
         @supervisor.stop_gracefully do
@@ -58,7 +59,6 @@ module Droonga
       else
         on_stop.call
       end
-      logger.trace("stop_gracefully: done")
     end
 
     def stop_immediately
-------------- next part --------------
HTML����������������������������...
다운로드 



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