Skip to content

Commit

Permalink
Rescue from any error from SerfEventHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 29, 2014
1 parent 55c9991 commit 8f38899
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/droonga/command/serf_event_handler.rb
Expand Up @@ -39,6 +39,13 @@ def run
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
Expand Down
8 changes: 8 additions & 0 deletions lib/droonga/path.rb
Expand Up @@ -74,6 +74,14 @@ def buffer
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

0 comments on commit 8f38899

Please sign in to comment.