From 70cd5f91d8667269a5fd17df4cd9368156286562 Mon Sep 17 00:00:00 2001 From: Oneric Date: Wed, 15 May 2024 02:17:34 +0200 Subject: [PATCH] dbprune/activites: prune array activities first This query is less costly; if something goes wrong or gets aborted later at least this part will arelady be done. --- lib/mix/tasks/pleroma/database.ex | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/mix/tasks/pleroma/database.ex b/lib/mix/tasks/pleroma/database.ex index 8bf4b38ca..87ccfdff1 100644 --- a/lib/mix/tasks/pleroma/database.ex +++ b/lib/mix/tasks/pleroma/database.ex @@ -97,14 +97,6 @@ defmodule Mix.Tasks.Pleroma.Database do # activites, it’s _much_ faster to utilise the index. To avoid accidentally # deleting useful activities should more types be added, keep typeof for singles. - # Prune activities who link to a single object - del_single = - if Keyword.get(opts, :singles, true) do - prune_orphaned_activities_singles(limit) - else - 0 - end - # Prune activities who link to an array of objects del_array = if Keyword.get(opts, :arrays, true) do @@ -113,6 +105,14 @@ defmodule Mix.Tasks.Pleroma.Database do 0 end + # Prune activities who link to a single object + del_single = + if Keyword.get(opts, :singles, true) do + prune_orphaned_activities_singles(limit) + else + 0 + end + del_single + del_array end