From 368767a702bfc661ea9dcd88db5beeda07e568ca Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Sat, 16 Aug 2025 14:38:02 -0400 Subject: [PATCH] Extract fetch all replies batch methods --- .../api/v1/statuses/contexts_controller.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/v1/statuses/contexts_controller.rb b/app/controllers/api/v1/statuses/contexts_controller.rb index 39451710ce9..ca48717b391 100644 --- a/app/controllers/api/v1/statuses/contexts_controller.rb +++ b/app/controllers/api/v1/statuses/contexts_controller.rb @@ -36,11 +36,14 @@ 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 - WorkerBatch.new.within do |batch| - batch.connect(refresh_key, threshold: 1.0) - ActivityPub::FetchAllRepliesWorker.perform_async(@status.id, { 'batch_id' => batch.id }) - 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