Preloading of follow relations for timeline/statuses rendering (performance improvement). Refactoring.

This commit is contained in:
Ivan Tashkinov 2020-03-23 12:01:11 +03:00
commit 3c78e5f327
5 changed files with 130 additions and 37 deletions

View file

@ -674,7 +674,14 @@ defmodule Pleroma.User do
def get_follow_state(%User{} = follower, %User{} = following) do
following_relationship = FollowingRelationship.get(follower, following)
get_follow_state(follower, following, following_relationship)
end
def get_follow_state(
%User{} = follower,
%User{} = following,
following_relationship
) do
case {following_relationship, following.local} do
{nil, false} ->
case Utils.fetch_latest_follow(follower, following) do