Class: Tolliver::Jobs::BatchPolicyJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/tolliver/jobs/batch_policy_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(notification_delivery_id, batch_size) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/tolliver/jobs/batch_policy_job.rb', line 6

def perform(notification_delivery_id, batch_size)

  # Instantiate notification delivery object
  notification_delivery = Tolliver.notification_delivery_model.find_by_id(notification_delivery_id)
  return nil if notification_delivery.nil? || notification_delivery.policy != :batch

  # Call policy logic
  policy_service = Tolliver::Services::Policies::Batch.new
  policy_service.deliver_batch_and_enqueue(notification_delivery, batch_size)

end