13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/rollgeist/notifier.rb', line 13
def notify(record, watchpoint)
return unless Rollgeist.enabled?
return if Rollgeist.suppressed?
configuration = Rollgeist.configuration
return unless configuration.watchpoint_enabled?(watchpoint)
mark = Rollgeist.mark_for(record)
return unless mark
report = Report.build(record: record, mark: mark, watchpoint: watchpoint)
return if ignored?(configuration, report)
return if configuration.warn_once && !claim_watchpoint(record, watchpoint)
decision = ExecutionState.claim(configuration.max_reports_per_request)
report_suppressed(decision.suppressed_to_flush) if decision.suppressed_to_flush
return unless decision.allowed
emit(report, configuration)
rescue GhostRecordAccess
raise
rescue StandardError => error
warn_safely("Rollgeist notifier failure: #{error.class}: #{error.message}")
end
|