[Groonga-commit] long-long-float/droonga-engine at 8f38899 [master] Rescue from any error from SerfEventHandler

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri Aug 29 21:07:39 JST 2014


YUKI Hiroshi	2014-08-29 21:07:39 +0900 (Fri, 29 Aug 2014)

  New Revision: 8f388991b15a0e583847b928bb388df1217e6c22
  https://github.com/long-long-float/droonga-engine/commit/8f388991b15a0e583847b928bb388df1217e6c22

  Message:
    Rescue from any error from SerfEventHandler

  Modified files:
    lib/droonga/command/serf_event_handler.rb
    lib/droonga/path.rb

  Modified: lib/droonga/command/serf_event_handler.rb (+7 -0)
===================================================================
--- lib/droonga/command/serf_event_handler.rb    2014-08-29 20:49:33 +0900 (b7f2802)
+++ lib/droonga/command/serf_event_handler.rb    2014-08-29 21:07:39 +0900 (12d0fb8)
@@ -39,6 +39,13 @@ module Droonga
         command.process if command.should_process?
         output_response(command.response)
         true
+      rescue Exception => exception
+        #XXX Any exception blocks following serf operations.
+        #    To keep it working, I rescue any exception for now.
+        File.open(Path.serf_event_handler_error_file, "w") do |file|
+          file.write(exception.inspect)
+        end
+        true
       end
 
       private

  Modified: lib/droonga/path.rb (+8 -0)
===================================================================
--- lib/droonga/path.rb    2014-08-29 20:49:33 +0900 (19ab72b)
+++ lib/droonga/path.rb    2014-08-29 21:07:39 +0900 (e58d193)
@@ -74,6 +74,14 @@ module Droonga
       def serf_event_handler_errors
         state + "serf-event-handler-errors"
       end
+
+      def serf_event_handler_error_file
+        now = Time.now
+        name = sprintf("%04d-%02d-%02d_%02d-%02d-%02d.%d.error",
+                       now.year, now.month, now.day,
+                       now.hour, now.min, now.sec, now.nsec)
+        serf_event_handler_errors + name
+      end
     end
   end
 end
-------------- next part --------------
HTML����������������������������...
Download 



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