Class: Findbug::AlertJob
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- Findbug::AlertJob
- Defined in:
- app/jobs/findbug/alert_job.rb
Overview
AlertJob sends alerts asynchronously.
WHY ASYNC ALERTS?
Alert sending involves:
-
HTTP requests to Slack/Discord webhooks
-
Email delivery (SMTP)
-
Potential network latency
If we did this synchronously during error capture:
-
Slow alerts would slow down error persistence
-
Failed alerts would block other alerts
-
Network issues would impact the persist job
By using a separate job:
-
PersistJob stays fast
-
Alerts can retry independently
-
Network issues are isolated
Instance Method Summary collapse
Instance Method Details
#perform(error_event_id) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'app/jobs/findbug/alert_job.rb', line 30 def perform(error_event_id) error_event = Findbug::ErrorEvent.find_by(id: error_event_id) return unless error_event Findbug::Alerts::Dispatcher.send_alerts(error_event) rescue ActiveRecord::RecordNotFound # Event was deleted, skip alerting Findbug.logger.debug("[Findbug] Alert skipped: error event #{error_event_id} not found") end |