You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
532 B

  1. # frozen_string_literal: true
  2. class RemoteAccountRefreshWorker
  3. include Sidekiq::Worker
  4. include ExponentialBackoff
  5. include JsonLdHelper
  6. sidekiq_options queue: 'pull', retry: 3
  7. def perform(id)
  8. account = Account.find_by(id: id)
  9. return if account.nil? || account.local?
  10. ActivityPub::FetchRemoteAccountService.new.call(account.uri)
  11. rescue Mastodon::UnexpectedResponseError => e
  12. response = e.response
  13. if response_error_unsalvageable?(response)
  14. # Give up
  15. else
  16. raise e
  17. end
  18. end
  19. end