Class: Motor::AlertSendingJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/motor/alert_sending_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(alert) ⇒ Object


5
6
7
8
9
10
11
# File 'app/jobs/motor/alert_sending_job.rb', line 5

def perform(alert)
  Motor::AlertLock.create!(alert_id: alert.id, lock_timestamp: alert.cron.previous_time.to_i)

  Motor::AlertsMailer.alert_email(alert).deliver_now!
rescue ActiveRecord::RecordNotUnique
  nil
end