[Groonga-commit] droonga/drndump at 47ac7ab [master] Determine the number of messages per second by default

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri Apr 17 16:55:36 JST 2015


YUKI Hiroshi	2015-04-17 16:55:36 +0900 (Fri, 17 Apr 2015)

  New Revision: 47ac7ab3b2fa32fc2b5c893df8535d8ed3645d13
  https://github.com/droonga/drndump/commit/47ac7ab3b2fa32fc2b5c893df8535d8ed3645d13

  Message:
    Determine the number of messages per second by default

  Modified files:
    lib/drndump/dump_client.rb

  Modified: lib/drndump/dump_client.rb (+9 -5)
===================================================================
--- lib/drndump/dump_client.rb    2015-04-17 16:41:15 +0900 (c610eba)
+++ lib/drndump/dump_client.rb    2015-04-17 16:55:36 +0900 (0b5fd6f)
@@ -19,6 +19,8 @@ require "droonga/client"
 
 module Drndump
   class DumpClient
+    DEFAULT_MESSAGES_PER_SECOND = 10000 # same to droogna-engine's one
+
     attr_reader :n_forecasted_messages, :n_received_messages
     attr_reader :error_message
     attr_writer :on_finish, :on_progress, :on_error
@@ -46,6 +48,7 @@ module Drndump
 
       @n_forecasted_messages = 0
       @n_received_messages = 0
+      @n_messages_per_second = DEFAULT_MESSAGES_PER_SECOND
 
       @error_message = nil
 
@@ -66,14 +69,15 @@ module Drndump
 
       n_dumpers = 0
 
-      dump_params = {}
-      if options[:messages_per_second]
-        dump_params["messagesPerSecond"] = options[:messages_per_second]
-      end
+      @n_messages_per_second = options[:messages_per_second] || DEFAULT_MESSAGES_PER_SECOND
+      @n_messages_per_second = [@n_messages_per_second, 1].max
+
       dump_message = {
         "type"    => "dump",
         "dataset" => @dataset,
-        "body"    => dump_params,
+        "body"    => {
+          "messagesPerSecond" => @n_messages_per_second,
+        },
       }
       client.subscribe(dump_message) do |message|
         on_progress(message)
-------------- next part --------------
HTML����������������������������...
Descargar 



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