1module Archived
 
2  class EmailPetitionersJob < ApplicationJob
 
3    include EmailAllPetitionSignatories
 
4
 
5    self.email_delivery_job_class = Archived::DeliverPetitionEmailJob
 
6    self.timestamp_name = 'petition_email'
 
7
 
8    attr_reader :email
 
 9
 
10    # It's likely that the email got deleted so we just log the error and move on
 
11    rescue_from ActiveJob::DeserializationError do |exception|
 
12      log_exception(exception)
 
13    end
 
  • Complexity 1 » saikuro
15    def perform(**args)
 
16      @email = args[:email]
 
17      super
 
18    end
 
 
20    private
 
  • Complexity 1 » saikuro
22    def mailer_arguments(signature)
 
23      super.merge(email: email)
 
24    end
 
  • Complexity 1 » saikuro
26    def log_exception(exception)
 
27      logger.info(log_message(exception))
 
28    end
 
  • Complexity 1 » saikuro
30    def log_message(exception)
 
31      "#{exception.class.name} while running #{self.class.name}"
 
32    end
 
33  end
 
34end