Class: Bulletin::Store::ActiveRecord

Inherits:
Base
  • Object
show all
Defined in:
lib/bulletin/store/active_record.rb

Overview

Durable backend: one issue row per fingerprint, with a capped ring of occurrence rows as evidence. Aggregate stats (count, first/last seen) live on the issue so the list view never has to scan occurrences.

Instance Method Summary collapse

Instance Method Details

#prune!Object



16
17
18
# File 'lib/bulletin/store/active_record.rb', line 16

def prune!
  Bulletin::Issue.where(arel_last_seen.lt(Bulletin.config.retention_cutoff)).find_each(&:destroy)
end

#record(payload) ⇒ Object



9
10
11
12
13
14
# File 'lib/bulletin/store/active_record.rb', line 9

def record(payload)
  warnings = Array(payload["warnings"])
  return if warnings.empty?

  warnings.each { |warning| record_one(warning, payload) }
end