Switch to inner joins which are expected to be faster

This commit is contained in:
Mark Felder 2022-11-15 12:49:44 -05:00
parent 0e1356ef9c
commit d8c112f2b0
3 changed files with 3 additions and 3 deletions

View file

@ -179,7 +179,7 @@ defmodule Pleroma.Activity do
def get_by_ap_id_with_object(ap_id) do
ap_id
|> Queries.by_ap_id()
|> with_preloaded_object(:left)
|> with_preloaded_object(:inner)
|> Repo.one()
end

View file

@ -36,7 +36,7 @@ defmodule Pleroma.Web.MastodonAPI.NotificationView do
end)
|> Enum.map(&object_id_for/1)
|> Activity.create_by_object_ap_id()
|> Activity.with_preloaded_object(:left)
|> Activity.with_preloaded_object(:inner)
|> Pleroma.Repo.all()
relationships_opt =

View file

@ -103,7 +103,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|> Enum.filter(&(&1.data["type"] == "Announce" && &1.data["object"]))
|> Enum.map(&Object.normalize(&1, fetch: false).data["id"])
|> Activity.create_by_object_ap_id()
|> Activity.with_preloaded_object(:left)
|> Activity.with_preloaded_object(:inner)
|> Activity.with_preloaded_bookmark(reading_user)
|> Activity.with_set_thread_muted_field(reading_user)
|> Repo.all()