Alter priority of Delete activities to be lowest

This will prevent a user with a large number of posts from negatively affecting performance of the outgoing federation queue if they delete their account.
This commit is contained in:
Mark Felder 2022-11-13 13:33:27 -05:00
commit 2e0089dd5c
4 changed files with 48 additions and 3 deletions

View file

@ -282,7 +282,6 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
# Tasks this handles:
# - Delete and unpins the create activity
# - Replace object with Tombstone
# - Set up notification
# - Reduce the user note count
# - Reduce the reply count
# - Stream out the activity

View file

@ -47,10 +47,15 @@ defmodule Pleroma.Web.Federator do
end
@impl true
def publish(activity) do
PublisherWorker.enqueue("publish", %{"activity_id" => activity.id})
def publish(%Pleroma.Activity{data: %{"type" => type}} = activity) do
PublisherWorker.enqueue("publish", %{"activity_id" => activity.id},
priority: publish_priority(type)
)
end
defp publish_priority("Delete"), do: 3
defp publish_priority(_), do: 0
# Job Worker Callbacks
@spec perform(atom(), module(), any()) :: {:ok, any()} | {:error, any()}