class Prevoty::ContentMonitor
Private Instance Methods
process_queue()
click to toggle source
# File lib/prevoty/content_monitor.rb, line 6 def process_queue cloned = @queue.clone @queue = [] Thread.new do data = cloned.inject([]) {|arr, i| arr.push i[:input]; arr} begin Timeout::timeout(@timeout) do resp = nil if defined? ActiveSupport::Notifications ActiveSupport::Notifications.instrument('prevoty:content:monitor') do |payload| resp = payload[:response] = res = @client.monitor_content(data) end end resp.each_with_index do |r, i| result = ::Rack::Prevoty::ContentMiddleware.build_result(cloned[i][:mode], cloned[i][:request], cloned[i][:input], r) if r.is_significant? || @log_verbosity === 'all' ::Prevoty::LOGGER << result.to_json + "\n" end end end rescue Exception => e ::Rails.logger.warn e.message end end end