mirror of
https://github.com/mastodon/mastodon.git
synced 2025-09-06 18:01:05 +00:00
Extract fetch all replies batch methods
This commit is contained in:
parent
1c4cbd0982
commit
368767a702
|
@ -36,13 +36,16 @@ class Api::V1::Statuses::ContextsController < Api::BaseController
|
|||
add_async_refresh_header(async_refresh)
|
||||
elsif current_account.present? && @status.should_fetch_replies?
|
||||
add_async_refresh_header(AsyncRefresh.create(refresh_key))
|
||||
queue_fetch_replies_worker_batch
|
||||
end
|
||||
end
|
||||
|
||||
def queue_fetch_replies_worker_batch
|
||||
WorkerBatch.new.within do |batch|
|
||||
batch.connect(refresh_key, threshold: 1.0)
|
||||
ActivityPub::FetchAllRepliesWorker.perform_async(@status.id, { 'batch_id' => batch.id })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def refresh_key
|
||||
"context:#{@status.id}:refresh"
|
||||
|
|
Loading…
Reference in New Issue
Block a user