account_refresh_worker.rb 414 B

1234567891011121314
  1. # frozen_string_literal: true
  2. class AccountRefreshWorker
  3. include Sidekiq::Worker
  4. sidekiq_options queue: 'pull', retry: 3, dead: false, lock: :until_executed, lock_ttl: 1.day.to_i
  5. def perform(account_id)
  6. account = Account.find_by(id: account_id)
  7. return if account.nil? || account.last_webfingered_at > Account::BACKGROUND_REFRESH_INTERVAL.ago
  8. ResolveAccountService.new.call(account)
  9. end
  10. end