[Groonga-commit] droonga/fluent-plugin-droonga at b4cb09c [master] Use JobQueue to fix not terminated

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Nov 26 16:15:08 JST 2013


Kouhei Sutou	2013-11-26 16:15:08 +0900 (Tue, 26 Nov 2013)

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

  Message:
    Use JobQueue to fix not terminated

  Modified files:
    lib/droonga/job_queue.rb
    lib/droonga/server.rb

  Modified: lib/droonga/job_queue.rb (+4 -0)
===================================================================
--- lib/droonga/job_queue.rb    2013-11-26 16:04:35 +0900 (2458588)
+++ lib/droonga/job_queue.rb    2013-11-26 16:15:08 +0900 (96ed113)
@@ -67,6 +67,10 @@ module Droonga
       MessagePack.unpack(packed_message)
     end
 
+    def unblock
+      @queue.unblock
+    end
+
     def close
       @queue = nil
       if @database

  Modified: lib/droonga/server.rb (+3 -7)
===================================================================
--- lib/droonga/server.rb    2013-11-26 16:04:35 +0900 (54af1ff)
+++ lib/droonga/server.rb    2013-11-26 16:15:08 +0900 (917838b)
@@ -15,7 +15,7 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-require "groonga"
+require "droonga/job_queue"
 
 module Droonga
   module Server
@@ -95,16 +95,12 @@ module Droonga
 
       def open_queue
         config =****@worke*****
-        # TODO: Use JobQueue object
-        context = Groonga::Context.new
-        database = context.open_database(config[:database])
-        queue = context[config[:queue_name]]
+        queue = JobQueue.open(config[:database],
+                              config[:queue_name] || "DroongaQueue")
         begin
           yield(queue)
         ensure
           queue.close
-          database.close
-          context.close
         end
       end
     end
-------------- next part --------------
HTML����������������������������...
Download 



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