Prune Objects --keep-threads option
Mergedfloatingghost merged 4 commits from
develop2 months ago
Reference in new issue
There is no content yet.
Delete Branch 'ilja/akkoma:prune_objects_whithout_breaking_threads'
Deleting a branch is permanent. It CANNOT be undone. Continue?
This adds an option to the prune_objects mix task.
The original way deleted all non-local public posts older than a certain time frame.
Here we add a different query which you can call using the option --keep-threads.
We query from the activities table all context id's where
1. the newest activity with this context is still old
2. none of the activities with this context is is local
3. none of the activities with this context is bookmarked
and delete all objects with these contexts.
The idea is that posts with local activities (posts, replies, likes, repeats...) may be interesting to keep.
Besides that, a post lives in a certain context (the thread), so we keep the whole thread as well.
Quotes have a different context. Therefore, when someone quotes a post, it's possible the quoted post will still be deleted.fixed in #379 Note that this removes from the objects table, but not from the activities.See #427 for that.
Some statistics from explain analyse:
(cost=1402845.92..1933782.00 rows=3810907 width=62) (actual time=2562455.486..2562455.495 rows=0 loops=1)
Planning Time: 505.327 ms
Trigger for constraint chat_message_references_object_id_fkey: time=651939.797 calls=921740
Trigger for constraint deliveries_object_id_fkey: time=52036.009 calls=921740
Trigger for constraint hashtags_objects_object_id_fkey: time=20665.778 calls=921740
Execution Time: 3287933.902 ms
We keep it as currently implemented and just don't care about scope with this option We add logic to not delete non-public posts either (I'll have to see how costly that becomes)
hm, decent point
i might err on giving quotes the same context?
though that might then cause them to be caught by context fetching
9ba6d1bb083 months ago
WIP: [I have questions] Prune Objects --keep-threads optionto Prune Objects --keep-threads option 3 months ago
f1739ac17b3 months ago
that's quite the query you've got going there, splitting into 2PRs was probably the right move
this one looks fine though! thanks a lot~
7695010268into develop 2 months ago