Skip to content
Permalink
908f37639a
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
31 lines (24 sloc) 684 Bytes
class PetitionCountJob < ApplicationJob
class InvalidSignatureCounts < RuntimeError; end
queue_as :high_priority
def perform
petitions = Petition.with_invalid_signature_counts
unless petitions.empty?
petitions.each(&:update_signature_count!)
Appsignal.send_exception(exception(petitions))
end
end
private
def exception(petitions)
InvalidSignatureCounts.new(error_message(petitions))
end
def error_message(petitions)
I18n.t(
:"invalid_signature_counts",
scope: :"petitions.errors",
count: petitions.size,
ids: petitions.map(&:id).inspect,
id: petitions.first.id.to_s
)
end
end