[Groonga-commit] droonga/droonga-engine at 2b6334b [master] Uniform timeout_seconds to timeout

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Apr 20 14:37:36 JST 2015


YUKI Hiroshi	2015-04-20 14:37:36 +0900 (Mon, 20 Apr 2015)

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

  Message:
    Uniform timeout_seconds to timeout

  Modified files:
    lib/droonga/dispatcher.rb
    lib/droonga/engine_state.rb
    lib/droonga/forwarder.rb
    lib/droonga/session.rb
    lib/droonga/single_step_definition.rb

  Modified: lib/droonga/dispatcher.rb (+9 -9)
===================================================================
--- lib/droonga/dispatcher.rb    2015-04-20 14:05:41 +0900 (858bc49)
+++ lib/droonga/dispatcher.rb    2015-04-20 14:37:36 +0900 (c706d96)
@@ -173,9 +173,9 @@ module Droonga
           collector_runner = @collector_runners[dataset]
           session = session_planner.create_session(id, self, collector_runner)
           if session.need_result?
-            timeout_seconds = message["timeout_seconds"] || nil
+            timeout = message["timeout"] || nil
             @engine_state.register_session(id, session,
-                                           :timeout_seconds => timeout_seconds)
+                                           :timeout => timeout)
             session.start
             logger.trace("process_internal_message: waiting for results")
           else
@@ -218,11 +218,11 @@ module Droonga
       id = @engine_state.generate_id
 
       destinations = []
-      timeout_seconds = nil
+      timeout = nil
       steps.each do |step|
-        calculated_timeout_seconds = timeout_seconds_from_step(step)
-        if calculated_timeout_seconds
-          timeout_seconds = calculated_timeout_seconds
+        calculated_timeout = timeout_from_step(step)
+        if calculated_timeout
+          timeout = calculated_timeout
         end
 
         dataset =****@catal*****(step["dataset"])
@@ -261,7 +261,7 @@ module Droonga
       dispatch_message = {
         "id"    => id,
         "steps" => steps,
-        "timeout_seconds" => timeout_seconds,
+        "timeout" => timeout,
       }
       destinations.uniq.each do |destination|
         dispatch(dispatch_message, destination)
@@ -311,7 +311,7 @@ module Droonga
       step_definition.write?
     end
 
-    def timeout_seconds_from_step(step)
+    def timeout_from_step(step)
       return nil unless step["dataset"]
 
       step_runner = @step_runners[step["dataset"]]
@@ -320,7 +320,7 @@ module Droonga
       step_definition = step_runner.find(step["command"])
       return nil unless step_definition
 
-      step_definition.timeout_seconds_for_step(step)
+      step_definition.timeout_for_step(step)
     end
 
     private

  Modified: lib/droonga/engine_state.rb (+2 -2)
===================================================================
--- lib/droonga/engine_state.rb    2015-04-20 14:05:41 +0900 (2221d88)
+++ lib/droonga/engine_state.rb    2015-04-20 14:37:36 +0900 (d3e4372)
@@ -128,8 +128,8 @@ module Droonga
       @sessions[id] = session
       logger.trace("new session #{id} is registered. rest sessions=#{@sessions.size}")
 
-      timeout_seconds = options[:timeout_seconds] || DEFAULT_SESSION_TIMEOUT_SECONDS
-      session.set_timeout(@loop, timeout_seconds) do
+      timeout = options[:timeout] || DEFAULT_SESSION_TIMEOUT_SECONDS
+      session.set_timeout(@loop, timeout) do
         logger.trace("session #{id} is timed out!")
         unregister_session(id)
       end

  Modified: lib/droonga/forwarder.rb (+3 -3)
===================================================================
--- lib/droonga/forwarder.rb    2015-04-20 14:05:41 +0900 (877cf1e)
+++ lib/droonga/forwarder.rb    2015-04-20 14:37:36 +0900 (c22e3c2)
@@ -35,8 +35,8 @@ module Droonga
       @senders = {}
       @auto_close_timers = {}
       @shutting_down = false
-      @auto_close_timeout_seconds = options[:auto_close_timeout_seconds] ||
-                                      DEFAULT_AUTO_CLOSE_TIMEOUT_SECONDS
+      @auto_close_timeout = options[:auto_close_timeout] ||
+                              DEFAULT_AUTO_CLOSE_TIMEOUT_SECONDS
     end
 
     def start
@@ -138,7 +138,7 @@ module Droonga
       previous_timer = @auto_close_timers[destination]
       previous_timer.detach if previous_timer
 
-      timer = Coolio::TimerWatcher.new(@auto_close_timeout_seconds)
+      timer = Coolio::TimerWatcher.new(@auto_close_timeout)
       on_timeout = lambda do
         timer.detach
         @auto_close_timers.delete(destination)

  Modified: lib/droonga/session.rb (+2 -2)
===================================================================
--- lib/droonga/session.rb    2015-04-20 14:05:41 +0900 (c997c9c)
+++ lib/droonga/session.rb    2015-04-20 14:37:36 +0900 (400fd89)
@@ -115,8 +115,8 @@ module Droonga
       end
     end
 
-    def set_timeout(loop, timeout_seconds, &on_timeout)
-      @timeout_timer = Coolio::TimerWatcher.new(timeout_seconds)
+    def set_timeout(loop, timeout, &on_timeout)
+      @timeout_timer = Coolio::TimerWatcher.new(timeout)
       on_timer = lambda do
         @timeout_timer.detach
         @timeout_timer = nil

  Modified: lib/droonga/single_step_definition.rb (+5 -5)
===================================================================
--- lib/droonga/single_step_definition.rb    2015-04-20 14:05:41 +0900 (56f64e6)
+++ lib/droonga/single_step_definition.rb    2015-04-20 14:37:36 +0900 (6d2fb28)
@@ -19,7 +19,7 @@ module Droonga
     attr_accessor :handler
     attr_accessor :collector
     attr_writer :write, :single_operation
-    attr_writer :timeout_seconds_calculator
+    attr_writer :timeout_calculator
     attr_accessor :inputs
     attr_accessor :output
     def initialize(plugin_module)
@@ -29,7 +29,7 @@ module Droonga
       @collector = nil
       @write = false
       @single_operation = false
-      @timeout_seconds_calculator = lambda do |step|
+      @timeout_calculator = lambda do |step|
         if step["timeout"]
           return step["timeout"]
         elsif step["body"]
@@ -52,9 +52,9 @@ module Droonga
       @single_operation
     end
 
-    def timeout_seconds_for_step(step)
-      if @timeout_seconds_calculator
-        @timeout_seconds_calculator.call(step)
+    def timeout_for_step(step)
+      if @timeout_calculator
+        @timeout_calculator.call(step)
       else
         nil
       end
-------------- next part --------------
HTML����������������������������...
Download 



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