[Groonga-commit] groonga/fluent-plugin-droonga at 545fec8 [master] Rely not on @pool but on @pool_size determining sync or async execution.

Back to archive index

Daijiro MORI null+****@clear*****
Wed Apr 24 15:54:52 JST 2013


Daijiro MORI	2013-04-24 15:54:52 +0900 (Wed, 24 Apr 2013)

  New Revision: 545fec8c3c30249559423453643147a4f1b80bae
  https://github.com/groonga/fluent-plugin-droonga/commit/545fec8c3c30249559423453643147a4f1b80bae

  Message:
    Rely not on @pool but on @pool_size determining sync or async execution.

  Modified files:
    lib/droonga/worker.rb

  Modified: lib/droonga/worker.rb (+5 -5)
===================================================================
--- lib/droonga/worker.rb    2013-04-24 15:46:09 +0900 (c0d2f2d)
+++ lib/droonga/worker.rb    2013-04-24 15:54:52 +0900 (86253de)
@@ -36,8 +36,8 @@ module Droonga
       Droonga::JobQueue.ensure_schema(@database_name, @queue_name)
       @handler_names = options[:handlers] || ["search"]
       load_handlers
-      pool_size = options[:pool_size] || 1
-      @pool = spawn(pool_size)
+      @pool_size = options[:pool_size] || 1
+      @pool = spawn
       prepare
     end
 
@@ -106,7 +106,7 @@ module Droonga
         handler = find_handler(command)
         if handler
           # synchronous = handler.prefer_synchronous? if synchronous.nil?
-          if route || @pool.empty? || synchronous
+          if route || @pool_size.zero? || synchronous
             handler.handle(command, body, *arguments)
           else
             unless message
@@ -192,9 +192,9 @@ module Droonga
       end
     end
 
-    def spawn(pool_size)
+    def spawn
       pool = []
-      pool_size.times do
+      @pool_size.times do
         pid = Process.fork
         if pid
           pool << pid
-------------- next part --------------
HTML����������������������������...
Download 



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