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.
This commit is contained in:
parent
aeaebb566c
commit
70cd5f91d8
1 changed files with 8 additions and 8 deletions
|
@ -97,14 +97,6 @@ def prune_orphaned_activities(limit \\ 0, opts \\ []) when is_number(limit) 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 @@ def prune_orphaned_activities(limit \\ 0, opts \\ []) when is_number(limit) 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
|
||||
|
||||
|
|
Loading…
Reference in a new issue