[Groonga-commit] droonga/droonga-engine at 726b52f [master] Output last processed timestamp to a file

Zurück zum Archiv-Index

YUKI Hiroshi null+****@clear*****
Fri May 23 18:24:04 JST 2014


YUKI Hiroshi	2014-05-23 18:24:04 +0900 (Fri, 23 May 2014)

  New Revision: 726b52f94a28ed08882a09c5845500d0ca2859fb
  https://github.com/droonga/droonga-engine/commit/726b52f94a28ed08882a09c5845500d0ca2859fb

  Message:
    Output last processed timestamp to a file

  Modified files:
    lib/droonga/engine.rb

  Modified: lib/droonga/engine.rb (+11 -0)
===================================================================
--- lib/droonga/engine.rb    2014-05-23 17:45:21 +0900 (b1f0aaf)
+++ lib/droonga/engine.rb    2014-05-23 18:24:04 +0900 (c9ee367)
@@ -26,6 +26,8 @@ module Droonga
   class Engine
     include Loggable
 
+    LAST_PROCESSED_TIMESTAMP_FILE_NAME = "last_processed_timestamp"
+
     def initialize(loop, name)
       @state = EngineState.new(loop, name)
 
@@ -56,6 +58,7 @@ module Droonga
 
     def shutdown
       logger.trace("shutdown: start")
+      output_last_processed_timestamp
       @catalog_observer.stop
       @live_nodes_list_observer.stop
       @dispatcher.shutdown
@@ -64,6 +67,7 @@ module Droonga
     end
 
     def process(message)
+      @last_processed_timestamp = message["date"]
       @dispatcher.process_message(message)
     end
 
@@ -86,6 +90,13 @@ module Droonga
       logger.trace("graceful_restart: done")
     end
 
+    def output_last_processed_timestamp
+      file_path = File.join(Droonga.state_dir_path, LAST_PROCESSED_TIMESTAMP_FILE_NAME)
+      File.open(file_path, "w") do |file|
+        file.write(@last_processed_timestamp)
+      end
+    end
+
     def log_tag
       "engine"
     end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index