2022-01-16 15:49:55 -08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
|
|
class RemoteAccountRefreshWorker
|
|
|
|
|
include Sidekiq::Worker
|
|
|
|
|
include ExponentialBackoff
|
|
|
|
|
include JsonLdHelper
|
|
|
|
|
|
|
|
|
|
sidekiq_options queue: 'pull', retry: 3
|
|
|
|
|
|
|
|
|
|
def perform(id)
|
|
|
|
|
account = Account.find_by(id: id)
|
|
|
|
|
return if account.nil? || account.local?
|
|
|
|
|
|
|
|
|
|
ActivityPub::FetchRemoteAccountService.new.call(account.uri)
|
|
|
|
|
rescue Mastodon::UnexpectedResponseError => e
|
|
|
|
|
response = e.response
|
|
|
|
|
|
2025-07-25 00:18:46 -07:00
|
|
|
raise(e) unless response_error_unsalvageable?(response)
|
2022-01-16 15:49:55 -08:00
|
|
|
end
|
|
|
|
|
end
|