No need to spawn() any more

This commit is contained in:
Floatingghost 2024-06-12 02:09:24 +01:00
parent ad52135bf5
commit 4d6fb43cbd
2 changed files with 1 additions and 12 deletions

View file

@ -26,12 +26,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
import Pleroma.Web.ActivityPub.Visibility, only: [get_visibility: 1, visible_for_user?: 2] import Pleroma.Web.ActivityPub.Visibility, only: [get_visibility: 1, visible_for_user?: 2]
# This is a naive way to do this, just spawning a process per activity
# to fetch the preview. However it should be fine considering
# pagination is restricted to 40 activities at a time
defp fetch_rich_media_for_activities(activities) do defp fetch_rich_media_for_activities(activities) do
Enum.each(activities, fn activity -> Enum.each(activities, fn activity ->
spawn(fn -> Card.get_by_activity(activity) end) Card.get_by_activity(activity)
end) end)
end end

View file

@ -93,14 +93,6 @@ defmodule Pleroma.Web.RichMedia.Card do
end end
end end
@spec get_by_object(Object.t()) :: t() | nil | :error
def get_by_object(object) do
case HTML.extract_first_external_url_from_object(object) do
nil -> nil
url -> get_or_backfill_by_url(url)
end
end
@spec get_by_activity(Activity.t()) :: t() | nil | :error @spec get_by_activity(Activity.t()) :: t() | nil | :error
# Fake/Draft activity # Fake/Draft activity
def get_by_activity(%Activity{id: "pleroma:fakeid"} = activity) do def get_by_activity(%Activity{id: "pleroma:fakeid"} = activity) do