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 |
# 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) 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. 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 true end |