class Prevoty::QueryMonitor

Private Instance Methods

process_queue() click to toggle source
# File lib/prevoty/query_monitor.rb, line 9
def process_queue
  cloned = @queue.clone
  @queue = []
  Thread.new do
    begin
      Timeout::timeout(@timeout) do
        resp = nil
        ActiveSupport::Notifications.instrument('prevoty:query:monitor') do |payload|
          resp = payload[:response] = @client.monitor_query(cloned)
        end
        resp.each_with_index do |r, i|
          if r.processed || @log_verbosity === 'all'
            Prevoty::LOGGER << build_result('monitor', cloned[i][:query], r).to_json + "\n"
          end
        end
      end
    rescue Exception => e
      ::Rails.logger.error e.message
    end
  end
end