[Groonga-commit] droonga/fluent-plugin-droonga at 0f083a6 [master] Increment envelope id if a fixed id is given

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Sep 12 11:59:43 JST 2013


YUKI Hiroshi	2013-09-12 11:59:43 +0900 (Thu, 12 Sep 2013)

  New Revision: 0f083a6b5b7aca680f23ba2a38ea2d072800d41d
  https://github.com/droonga/fluent-plugin-droonga/commit/0f083a6b5b7aca680f23ba2a38ea2d072800d41d

  Message:
    Increment envelope id if a fixed id is given

  Modified files:
    lib/groonga_command_converter.rb

  Modified: lib/groonga_command_converter.rb (+11 -2)
===================================================================
--- lib/groonga_command_converter.rb    2013-09-12 11:41:59 +0900 (c169206)
+++ lib/groonga_command_converter.rb    2013-09-12 11:59:43 +0900 (27b3609)
@@ -25,6 +25,7 @@ module Droonga
 
     def initialize(options={})
       @options = options
+      @count = 0
     end
 
     def convert(input, &block)
@@ -43,14 +44,22 @@ module Droonga
 
     private
     def create_envelope(type, body)
+      id = @options[:id]
+      if id.nil?
+        id = new_unique_id
+      else
+        id = "#{id}:#{@count}"
+        @count += 1
+      end
+
       {
-        :id => @options[:id] || new_unique_id,
+        :id => id,
         :date => @options[:date] || current_date,
         :replyTo => @options[:reply_to],
         :statusCode => @options[:status_code] || STATUS_OK,
         :dataset => @options[:dataset],
         :type => type,
-        :body => body
+        :body => body,
       }
     end
 
-------------- next part --------------
HTML����������������������������...
Download 



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