Add fetch_instance_info_worker_spec
This commit is contained in:
parent
18583e5275
commit
15d0117b3b
4 changed files with 70 additions and 5 deletions
|
@ -209,7 +209,7 @@ class ActivityPub::ProcessAccountService < BaseService
|
|||
end
|
||||
|
||||
def fetch_instance_info
|
||||
FetchInstanceInfoWorker.perform_async(@account.domain) unless InstanceInfo.exists?(domain: @account.domain)
|
||||
ActivityPub::FetchInstanceInfoWorker.perform_async(@account.domain) unless InstanceInfo.exists?(domain: @account.domain)
|
||||
end
|
||||
|
||||
def actor_type
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class FetchInstanceInfoWorker
|
||||
class ActivityPub::FetchInstanceInfoWorker
|
||||
include Sidekiq::Worker
|
||||
include JsonLdHelper
|
||||
include Redisable
|
||||
|
@ -64,9 +64,9 @@ class FetchInstanceInfoWorker
|
|||
|
||||
body_to_json(response.body_with_limit)
|
||||
elsif response.code == 410
|
||||
raise FetchInstanceInfoWorker::GoneError, "#{domain} is gone from the server"
|
||||
raise ActivityPub::FetchInstanceInfoWorker::GoneError, "#{@instance.domain} is gone from the server"
|
||||
else
|
||||
raise FetchInstanceInfoWorker::RequestError, "Request for #{domain} returned HTTP #{response.code}"
|
||||
raise ActivityPub::FetchInstanceInfoWorker::RequestError, "Request for #{@instance.domain} returned HTTP #{response.code}"
|
||||
end
|
||||
end
|
||||
end
|
|
@ -7,7 +7,7 @@ class Scheduler::UpdateInstanceInfoScheduler
|
|||
|
||||
def perform
|
||||
Instance.select(:domain).reorder(nil).find_in_batches do |instances|
|
||||
FetchInstanceInfoWorker.push_bulk(instances) do |instance|
|
||||
ActivityPub::FetchInstanceInfoWorker.push_bulk(instances) do |instance|
|
||||
[instance.domain]
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue