Class: Droonga::Command::SerfEventHandler
- Inherits:
-
Object
- Object
- Droonga::Command::SerfEventHandler
- Defined in:
- lib/droonga/command/serf_event_handler.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ SerfEventHandler
constructor
A new instance of SerfEventHandler.
- #run ⇒ Object
Constructor Details
#initialize ⇒ SerfEventHandler
Returns a new instance of SerfEventHandler.
30 31 32 |
# File 'lib/droonga/command/serf_event_handler.rb', line 30 def initialize @payload = nil end |
Class Method Details
.run ⇒ Object
25 26 27 |
# File 'lib/droonga/command/serf_event_handler.rb', line 25 def run new.run end |
Instance Method Details
#run ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/droonga/command/serf_event_handler.rb', line 34 def run command_class = detect_command_class return true if command_class.nil? serf_name = ENV["SERF_SELF_NAME"] command = command_class.new(serf_name, @payload) begin command.process if command.should_process? rescue Exception => exception command.log("Exception: #{exception.inspect}, #{exception.}, #{exception.backtrace.join(", ")}") raise exception ensure output_response(command.response) end true rescue Exception => exception #XXX Any exception blocks following serf operations. # To keep it working, I rescue any exception for now. begin FileUtils.mkdir_p(Path.serf_event_handler_errors) File.open(Path.serf_event_handler_error_file, "w") do |file| file.write(exception.inspect) file.write(exception.backtrace) end rescue Errno::EACCES => end puts exception.inspect puts exception.backtrace true end |