[Groonga-commit] droonga/droonga-engine at 9e7f5e2 [master] Re-unify callback for on_ready of required tasks

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Mar 19 19:34:28 JST 2015


YUKI Hiroshi	2015-03-19 19:34:28 +0900 (Thu, 19 Mar 2015)

  New Revision: 9e7f5e2e28dcef1ee91c3e12c0ca6ac2ca6bbeae
  https://github.com/droonga/droonga-engine/commit/9e7f5e2e28dcef1ee91c3e12c0ca6ac2ca6bbeae

  Message:
    Re-unify callback for on_ready of required tasks

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

  Modified: lib/droonga/command/droonga_engine.rb (+13 -13)
===================================================================
--- lib/droonga/command/droonga_engine.rb    2015-03-19 19:20:44 +0900 (e30aa88)
+++ lib/droonga/command/droonga_engine.rb    2015-03-19 19:34:28 +0900 (d8d401f)
@@ -423,26 +423,26 @@ module Droonga
         def setup_initial_on_ready
           return if****@confi*****_notify_fd.nil?
 
-          rest_tasks = 0
+          n_rest_tasks = 0
+          on_ready = lambda do
+            n_rest_tasks -= 1
+            return unless n_rest_tasks.zero?
 
+            output = IO.new(@configuration.ready_notify_fd)
+            output.puts("ready")
+            output.close
+          end
+
+          n_rest_tasks += 1
           @service_runner.on_ready = lambda do
-            rest_tasks -= 1
-            notify_initial_ready if rest_tasks.zero?
+            on_ready.call
           end
-          rest_tasks += 1
 
+          n_rest_tasks += 1
           @serf_agent.on_ready = lambda do
             @serf.update_cluster_state
-            rest_tasks -= 1
-            notify_initial_ready if rest_tasks.zero?
+            on_ready.call
           end
-          rest_tasks += 1
-        end
-
-        def notify_initial_ready
-          output = IO.new(@configuration.ready_notify_fd)
-          output.puts("ready")
-          output.close
         end
 
         def trap_signals
-------------- next part --------------
HTML����������������������������...
Download 



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