lib/dexter/processor.rb in pgdexter-0.1.5 vs lib/dexter/processor.rb in pgdexter-0.1.6

- old
+ new

@@ -1,12 +1,10 @@ module Dexter class Processor include Logging def initialize(database_url, logfile, options) - log "Started" - @logfile = logfile @collector = Collector.new(min_time: options[:min_time]) @log_parser = LogParser.new(logfile, @collector) @indexer = Indexer.new(database_url, options) @@ -14,18 +12,24 @@ @starting_interval = 3 @interval = options[:interval] @mutex = Mutex.new @last_checked_at = {} + + log "Started" end def perform if @logfile == STDIN Thread.abort_on_exception = true Thread.new do sleep(@starting_interval) loop do - process_queries + begin + process_queries + rescue PG::ServerError => e + log "ERROR: #{e.class.name}: #{e.message}" + end sleep(@interval) end end end