1class EmailDuplicateSignaturesEmailJob < EmailJob |
|
2 self.mailer = PetitionMailer |
|
3 self.email = :email_duplicate_signatures |
|
5 rescue_from(ActiveJob::DeserializationError) do |exception| |
|
6 Appsignal.send_exception exception |
|
7 end |
|
|
9 def perform(signature) |
10 mailer.send(email, signature).deliver_now
|
|
11 Signature.increment_counter(:email_count, signature.id) |
|
12 end |
|
14 private
|
|
|
16 def rate_limit |
17 @rate_limit ||= RateLimit.first_or_create! |
|
18 end |
|
19end |