1class DeletePetitionsJob < ApplicationJob
 
2  queue_as :high_priority
 
3
  • Complexity 3 » saikuro
4  def perform
 
5    if Petition.unarchived.exists?
 
6      raise RuntimeError, "Deleting petitions before they are archived will result in a loss of data"
 
7    end
 
8
 
 9    Petition.find_each do |petition|
 
10      DeletePetitionJob.perform_later(petition)
 
11    end
 
12  end
 
13end