[Groonga-commit] groonga/fluent-plugin-kotoumi [master] Close database on shutdown

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Jan 30 17:55:01 JST 2013


Kouhei Sutou	2013-01-30 17:55:01 +0900 (Wed, 30 Jan 2013)

  New Revision: 9340ad5b943272eeb06541c8392b18f925be5934
  https://github.com/groonga/fluent-plugin-kotoumi/commit/9340ad5b943272eeb06541c8392b18f925be5934

  Log:
    Close database on shutdown

  Modified files:
    lib/fluent/plugin/out_kotoumi.rb
    lib/kotoumi/worker.rb

  Modified: lib/fluent/plugin/out_kotoumi.rb (+1 -0)
===================================================================
--- lib/fluent/plugin/out_kotoumi.rb    2013-01-30 17:51:45 +0900 (afe87c7)
+++ lib/fluent/plugin/out_kotoumi.rb    2013-01-30 17:55:01 +0900 (fbcc219)
@@ -35,6 +35,7 @@ module Fluent
 
     def shutdown
       super
+      @worker.shutdown
       @outputs.each do |dest, socket|
         socket.close
       end

  Modified: lib/kotoumi/worker.rb (+8 -1)
===================================================================
--- lib/kotoumi/worker.rb    2013-01-30 17:51:45 +0900 (7b67b3c)
+++ lib/kotoumi/worker.rb    2013-01-30 17:55:01 +0900 (d071cbe)
@@ -20,11 +20,18 @@ require 'groonga'
 module Kotoumi
   class Worker
     def initialize(database, queue_name)
-      Groonga::Database.open(database)
+      @database = Groonga::Database.open(database)
       @ctx = Groonga::Context.default
       @queue_name = queue_name
     end
 
+    def shutdown
+      @database.close
+      @ctx.close
+      @database = @ctx = nil
+      Groonga::Context.default = nil
+    end
+
     def process_message(record)
       return {
         "main-search-result" => {
-------------- next part --------------
HTML����������������������������...
Download 



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