Class: RailsErrorDashboard::StormFlushJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
app/jobs/rails_error_dashboard/storm_flush_job.rb

Overview

Persists storm-protection count snapshots (mirrors SwallowedExceptionFlushJob): the gate accumulates counts in memory with zero I/O, snapshots are handed to this job at most once per flush interval, and ALL DB writes happen here.

Instance Method Summary collapse

Instance Method Details

#perform(entries: [], overflow: 0, episode: nil) ⇒ Object



10
11
12
13
14
15
16
17
# File 'app/jobs/rails_error_dashboard/storm_flush_job.rb', line 10

def perform(entries: [], overflow: 0, episode: nil)
  entries = entries.map { |e| e.respond_to?(:stringify_keys) ? e.stringify_keys : e }
  episode = episode.stringify_keys if episode.respond_to?(:stringify_keys)

  Commands::FlushStormCounts.call(entries: entries, overflow: overflow, episode: episode)
rescue => e
  Rails.logger.error("[RailsErrorDashboard] StormFlushJob failed: #{e.class} - #{e.message}")
end