From 9ef5532a7ece064ee76bb345abef03bbd6b64418 Mon Sep 17 00:00:00 2001 From: abcang Date: Tue, 1 Oct 2019 00:02:03 +0900 Subject: [PATCH] Fix follow requests N+1 (#12004) --- app/services/update_account_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/update_account_service.rb b/app/services/update_account_service.rb index ebf24be376..4172d57740 100644 --- a/app/services/update_account_service.rb +++ b/app/services/update_account_service.rb @@ -21,7 +21,7 @@ class UpdateAccountService < BaseService def authorize_all_follow_requests(account) follow_requests = FollowRequest.where(target_account: account) - follow_requests = follow_requests.select { |req| !req.account.silenced? } + follow_requests = follow_requests.preload(:account).select { |req| !req.account.silenced? } AuthorizeFollowWorker.push_bulk(follow_requests) do |req| [req.account_id, req.target_account_id] end