[Groonga-commit] droonga/fluent-plugin-droonga at 91e161a [master] Ensure job-queue schema before forking.

Back to archive index

Daijiro MORI null+****@clear*****
Sun Sep 8 20:38:26 JST 2013


Daijiro MORI	2013-09-08 20:38:26 +0900 (Sun, 08 Sep 2013)

  New Revision: 91e161a44ef91f1e779b72d0a6f4d5c281b3075b
  https://github.com/droonga/fluent-plugin-droonga/commit/91e161a44ef91f1e779b72d0a6f4d5c281b3075b

  Message:
    Ensure job-queue schema before forking.

  Modified files:
    lib/droonga/engine.rb
    lib/droonga/executor.rb

  Modified: lib/droonga/engine.rb (+4 -0)
===================================================================
--- lib/droonga/engine.rb    2013-09-08 20:15:23 +0900 (b175222)
+++ lib/droonga/engine.rb    2013-09-08 20:38:26 +0900 (dba3102)
@@ -44,6 +44,10 @@ module Droonga
         database = File.join([File.basename(name), 'db'])
         @options[:database] = database
       end
+      if @options[:database] && !@options[:database].empty?
+        Droonga::JobQueue.ensure_schema(@options[:database],
+                                        @options[:queue_name])
+      end
       if @options[:n_workers] > 0 || @options[:with_server]
         @message_input, @message_output = IO.pipe
         @message_input.sync = true

  Modified: lib/droonga/executor.rb (+13 -10)
===================================================================
--- lib/droonga/executor.rb    2013-09-08 20:15:23 +0900 (29976de)
+++ lib/droonga/executor.rb    2013-09-08 20:38:26 +0900 (97dea4a)
@@ -33,9 +33,8 @@ module Droonga
       @outputs = {}
       @options = options
       @name = options[:name]
-      @database_name = options[:database] || "droonga/db"
-      @queue_name = options[:queue_name] || "DroongaQueue"
-      Droonga::JobQueue.ensure_schema(@database_name, @queue_name)
+      @database_name = options[:database]
+      @queue_name = options[:queue_name]
       @handler_names = options[:handlers]
       @pool_size = options[:n_workers]
 #     load_handlers
@@ -51,9 +50,11 @@ module Droonga
         output[:logger].close if output[:logger]
       end
       @queue = nil
-      @database.close
-      @context.close
-      @database = @context = nil
+      if @database
+        @database.close
+        @context.close
+        @database = @context = nil
+      end
     end
 
     def unblock_queue
@@ -210,10 +211,12 @@ module Droonga
     end
 
     def prepare
-      @context = Groonga::Context.new
-      @database =****@conte*****_database(@database_name)
-      @context.encoding = :none
-      @queue = @context[@queue_name]
+      if @database_name && !@database_name.empty?
+        @context = Groonga::Context.new
+        @database =****@conte*****_database(@database_name)
+        @context.encoding = :none
+        @queue = @context[@queue_name]
+      end
       @handler_names.each do |handler_name|
         add_handler(handler_name)
       end
-------------- next part --------------
HTML����������������������������...
Download 



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