[Groonga-commit] droonga/droonga-engine at bba5bd5 [master] Prepare the placeholder to implement codes to stop remote processes

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Nov 26 15:58:15 JST 2014


YUKI Hiroshi	2014-11-26 15:58:15 +0900 (Wed, 26 Nov 2014)

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

  Message:
    Prepare the placeholder to implement codes to stop remote processes

  Modified files:
    bin/droonga-engine-absorb-data

  Modified: bin/droonga-engine-absorb-data (+22 -0)
===================================================================
--- bin/droonga-engine-absorb-data    2014-11-26 15:56:41 +0900 (9252e64)
+++ bin/droonga-engine-absorb-data    2014-11-26 15:58:15 +0900 (2bc4628)
@@ -30,6 +30,7 @@ class AbsorbDataCommand
   def run
     parse_options
     assert_valid_options
+    trap_signals
 
     puts "Start to absorb data from #{@options.source_host}"
     puts "                       to #{@options.destination_host}"
@@ -201,6 +202,27 @@ class AbsorbDataCommand
       status.set(:effective_message_timestamp, timestamp)
     end
   end
+
+  def trap_signals
+    trap(:TERM) do
+      do_cancel
+      trap(:TERM, "DEFAULT")
+    end
+
+    trap(:INT) do
+      do_cancel
+      trap(:INT, "DEFAULT")
+    end
+
+    trap(:QUIT) do
+      do_cancel
+      trap(:QUIT, "DEFAULT")
+    end
+  end
+
+  def do_cancel
+    #XXX we have to write more codes to cancel remote processes!
+  end
 end
 
 AbsorbDataCommand.new.run
-------------- next part --------------
HTML����������������������������...
下載 



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