diff options
author | Mark Felder <feld@feld.me> | 2022-11-13 13:33:27 -0500 |
---|---|---|
committer | Mark Felder <feld@feld.me> | 2022-11-13 14:11:48 -0500 |
commit | 2e0089dd5c27c86488d2c68170d80d02c24135f3 (patch) | |
tree | 27090258c5e20b89d05c73a77ce02a61c7033bc8 /lib | |
parent | 47b9847edd74c394e2bdfcb95a42f858329c9ef1 (diff) | |
download | pleroma-2e0089dd5c27c86488d2c68170d80d02c24135f3.tar.gz pleroma-2e0089dd5c27c86488d2c68170d80d02c24135f3.zip |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/activity_pub/side_effects.ex | 1 | ||||
-rw-r--r-- | lib/pleroma/web/federator.ex | 9 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/pleroma/web/activity_pub/side_effects.ex b/lib/pleroma/web/activity_pub/side_effects.ex index b2e15e1a0..a2152b945 100644 --- a/lib/pleroma/web/activity_pub/side_effects.ex +++ b/lib/pleroma/web/activity_pub/side_effects.ex @@ -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 diff --git a/lib/pleroma/web/federator.ex b/lib/pleroma/web/federator.ex index 3be71c1b6..318b6cb11 100644 --- a/lib/pleroma/web/federator.ex +++ b/lib/pleroma/web/federator.ex @@ -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()} |