1class ClosePetitionsEarlyJob < ApplicationJob
 
2  queue_as :high_priority
 
3
 
4  class << self
 
5    def schedule_for(time)
 
6      set(wait_until: time).perform_later(time.iso8601)
 
7    end
 
8  end
 
 9
  • UtilityFunction - doesn't depend on instance state (maybe move it to another class?) » reek
  • Complexity 1 » saikuro
10  def perform(time)
 
11    Petition.close_petitions_early!(time.in_time_zone)
 
12  end
 
13end