verify_account_links_worker.rb 462 B

12345678910111213141516171819
  1. # frozen_string_literal: true
  2. class VerifyAccountLinksWorker
  3. include Sidekiq::Worker
  4. sidekiq_options queue: 'default', retry: false, lock: :until_executed, lock_ttl: 1.hour.to_i
  5. def perform(account_id)
  6. account = Account.find(account_id)
  7. account.fields.each do |field|
  8. VerifyLinkService.new.call(field) if field.requires_verification?
  9. end
  10. account.save! if account.changed?
  11. rescue ActiveRecord::RecordNotFound
  12. true
  13. end
  14. end