[Groonga-commit] droonga/droonga-engine at b430e10 [master] Remove needless helper method

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri Jun 27 12:11:34 JST 2014


YUKI Hiroshi	2014-06-27 12:11:34 +0900 (Fri, 27 Jun 2014)

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

  Message:
    Remove needless helper method

  Modified files:
    lib/droonga/dispatcher.rb

  Modified: lib/droonga/dispatcher.rb (+6 -12)
===================================================================
--- lib/droonga/dispatcher.rb    2014-06-26 19:43:56 +0900 (585f833)
+++ lib/droonga/dispatcher.rb    2014-06-27 12:11:34 +0900 (f433a25)
@@ -172,8 +172,10 @@ module Droonga
       id = @engine_state.generate_id
 
       one_way_steps = []
+      one_way_destinations = []
       have_dead_nodes = !@engine_state.dead_nodes.empty?
 
+      destinations = []
       steps.each do |step|
         dataset =****@catal*****(step["dataset"])
         if dataset
@@ -183,6 +185,7 @@ module Droonga
               one_way_step = Marshal.load(Marshal.dump(step))
               one_way_step["routes"] = routes
               one_way_steps << one_way_step
+              one_way_destinations += routes.collect(&:farm_path)
             end
           end
           routes = dataset.get_routes(step, @engine_state.live_nodes)
@@ -190,32 +193,23 @@ module Droonga
         else
           step["routes"] ||= [id]
         end
+        destinations += step["routes"].collect(&:farm_path)
       end
 
       dispatch_message = { "id" => id, "steps" => steps }
-      get_destinations(steps).each do |destination|
+      destinations.uniq.each do |destination|
         dispatch(dispatch_message, destination)
       end
 
       unless one_way_steps.empty?
         dispatch_message = { "id" => @engine_state.generate_id,
                              "steps" => one_way_steps }
-        get_destinations(one_way_steps).each do |destination|
+        one_way_destinations.uniq.each do |destination|
           dispatch(dispatch_message, destination)
         end
       end
     end
 
-    def get_destinations(steps)
-      destinations = {}
-      steps.each do |step|
-        step["routes"].each do |route|
-          destinations[farm_path(route)] = true
-        end
-      end
-      destinations.keys
-    end
-
     def process_local_message(local_message)
       task = local_message["task"]
       slice_name = task["route"]
-------------- next part --------------
HTML����������������������������...
Télécharger 



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