21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-05-16 23:48:38 +02:00
chexpire/app/jobs/resync_job.rb

19 lines
512 B
Ruby
Raw Permalink Normal View History

class ResyncJob < ApplicationJob
queue_as :default
rescue_from ActiveRecord::RecordNotFound do
raise if attempt_number == 5 # rubocop:disable Style/SignalException
# at job creation, the db could not return immediately the check
# we have to wait a few (milli)-seconds
retry_job(wait: attempt_number**2)
end
def perform(check_id)
check = Check.find(check_id)
WhoisSyncJob.perform_later(check_id) if check.domain?
SSLSyncJob.perform_later(check_id) if check.ssl?
end
end