lib/prosopite.rb in prosopite-1.1.4 vs lib/prosopite.rb in prosopite-1.2.0
- old
+ new
@@ -8,11 +8,13 @@
:stderr_logger,
:rails_logger,
:prosopite_logger,
:custom_logger,
:allow_stack_paths,
- :ignore_queries
+ :ignore_queries,
+ :ignore_pauses,
+ :min_n_queries
def allow_list=(value)
puts "Prosopite.allow_list= is deprecated. Use Prosopite.allow_stack_paths= instead."
self.allow_stack_paths = value
@@ -27,10 +29,12 @@
tc[:prosopite_query_counter] = Hash.new(0)
tc[:prosopite_query_holder] = Hash.new { |h, k| h[k] = [] }
tc[:prosopite_query_caller] = {}
@allow_stack_paths ||= []
+ @ignore_pauses ||= false
+ @min_n_queries ||= 2
tc[:prosopite_scan] = true
if block_given?
begin
@@ -46,10 +50,14 @@
def tc
Thread.current
end
def pause
+ if @ignore_pauses
+ return block_given? ? yield : nil
+ end
+
if block_given?
begin
previous = tc[:prosopite_scan]
tc[:prosopite_scan] = false
yield
@@ -81,10 +89,10 @@
def create_notifications
tc[:prosopite_notifications] = {}
tc[:prosopite_query_counter].each do |location_key, count|
- if count > 1
+ if count >= @min_n_queries
fingerprints = tc[:prosopite_query_holder][location_key].map do |q|
begin
fingerprint(q)
rescue
raise q