[Groonga-commit] droonga/drnbench at 0304fa3 [master] Accept default timeout option

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Jul 30 12:39:16 JST 2014


YUKI Hiroshi	2014-07-30 12:39:16 +0900 (Wed, 30 Jul 2014)

  New Revision: 0304fa374f01f8a2f129886113a936202c2192f6
  https://github.com/droonga/drnbench/commit/0304fa374f01f8a2f129886113a936202c2192f6

  Message:
    Accept default timeout option

  Modified files:
    bin/drnbench-request-response
    lib/drnbench/client/http.rb
    lib/drnbench/request-response/configuration.rb
    lib/drnbench/request-response/runner.rb

  Modified: bin/drnbench-request-response (+4 -0)
===================================================================
--- bin/drnbench-request-response    2014-07-30 11:59:19 +0900 (32fa8af)
+++ bin/drnbench-request-response    2014-07-30 12:39:16 +0900 (1f1dd1f)
@@ -74,6 +74,10 @@ option_parser = OptionParser.new do |parser|
             "default HTTP method (optional)") do |method|
     config.default_method = method
   end
+  parser.on("--default-timeout=SECONDS", Float,
+            "default timeout (optional)") do |timeout|
+    config.default_timeout = timeout
+  end
 
   parser.on("--output-path=PATH",
             "path to output statistics as a CSV file (optional)") do |path|

  Modified: lib/drnbench/client/http.rb (+3 -1)
===================================================================
--- lib/drnbench/client/http.rb    2014-07-30 11:59:19 +0900 (b786325)
+++ lib/drnbench/client/http.rb    2014-07-30 12:39:16 +0900 (7bb9d53)
@@ -38,7 +38,8 @@ module Drnbench
 
           client = Droonga::Client.new(:protocol => :http,
                                        :host => request["host"],
-                                       :port => request["port"])
+                                       :port => request["port"],
+                                       :timeout => request["timeout"])
           request["headers"] ||= {}
           request["headers"]["user-agent"] = "Ruby/#{RUBY_VERSION} Droonga::Benchmark::Runner::HttpClient"
           start_time = Time.now
@@ -83,6 +84,7 @@ module Drnbench
       unless SUPPORTED_HTTP_METHODS.include?(request["method"])
         request["method"] = "GET"
       end
+      request["timeout"] ||=****@confi*****_timeout
       request
     end
   end

  Modified: lib/drnbench/request-response/configuration.rb (+2 -1)
===================================================================
--- lib/drnbench/request-response/configuration.rb    2014-07-30 11:59:19 +0900 (89c20c0)
+++ lib/drnbench/request-response/configuration.rb    2014-07-30 12:39:16 +0900 (28aac94)
@@ -21,7 +21,7 @@ module Drnbench
       attr_accessor :duration, :wait, :request_patterns_file
       attr_accessor :start_n_clients, :end_n_clients, :step, :n_requests, :n_slow_requests
       attr_accessor :mode
-      attr_accessor :default_host, :default_port, :default_path, :default_method
+      attr_accessor :default_host, :default_port, :default_path, :default_method, :default_timeout
       attr_accessor :report_progressively, :output_path
 
       MIN_DURATION = 1
@@ -40,6 +40,7 @@ module Drnbench
         @default_port         = 80
         @default_path         = "/"
         @default_method       = "GET"
+        @default_timeout      = 5.0
 
         @report_progressively = true
         @output_path          = "/tmp/drnbench-result.csv"

  Modified: lib/drnbench/request-response/runner.rb (+1 -0)
===================================================================
--- lib/drnbench/request-response/runner.rb    2014-07-30 11:59:19 +0900 (bcbc3f2)
+++ lib/drnbench/request-response/runner.rb    2014-07-30 12:39:16 +0900 (0c85413)
@@ -113,6 +113,7 @@ module Drnbench
           pattern["host"] ||= request_pattern["host"]
           pattern["port"] ||= request_pattern["port"]
           pattern["method"] ||= request_pattern["method"]
+          pattern["timeout"] ||= request_pattern["timeout"]
           @requests << pattern
         end
       end
-------------- next part --------------
HTML����������������������������...
下載 



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