1class ArchivePetitionsJob < ApplicationJob
 
2  queue_as :high_priority
 
3
  • UtilityFunction - doesn't depend on instance state (maybe move it to another class?) » reek
  • Complexity 4 » saikuro
4  def perform
 
5    Appsignal.without_instrumentation do
 
6      Petition.find_each do |petition|
 
7        next if petition.archived?
 
8
 
 9        ArchivePetitionJob.perform_later(petition)
 
10        petition.update_column(:archiving_started_at, Time.current)
 
11      end
 
12    end
 
13  end
 
14end