[Groonga-commit] droonga/fluent-plugin-droonga at df664aa [master] Add a mechanism to run garbage collection periodically

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Oct 31 12:22:33 JST 2013


YUKI Hiroshi	2013-10-31 12:22:33 +0900 (Thu, 31 Oct 2013)

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

  Message:
    Add a mechanism to run garbage collection periodically

  Modified files:
    lib/droonga/watcher.rb

  Modified: lib/droonga/watcher.rb (+16 -0)
===================================================================
--- lib/droonga/watcher.rb    2013-10-31 12:21:53 +0900 (a462c25)
+++ lib/droonga/watcher.rb    2013-10-31 12:22:33 +0900 (e76d081)
@@ -18,9 +18,11 @@
 module Droonga
   class Watcher
     EXACT_MATCH = false
+    GARBAGE_COLLECTION_INTERVAL_SECONDS = 20 * 60 # 20 min
 
     def initialize(context)
       @context = context
+      activate_garbage_collection
     end
 
     def subscribe(request)
@@ -170,5 +172,19 @@ module Droonga
         yield(route, subscribers)
       end
     end
+
+    def activate_garbage_collection(options={})
+      interval = options[:interval] || GARBAGE_COLLECTION_INTERVAL_SECONDS
+      @gc_thread = Thread.new do
+        while true
+          clear_expired_subscribers
+          sleep(interval)
+        end
+      end
+    end
+
+    def clear_expired_subscribers
+      # implement me!
+    end
   end
 end
-------------- next part --------------
HTML����������������������������...
Download 



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