diff options
author | ThibG <thib@sitedethib.com> | 2020-12-22 23:57:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-22 23:57:46 +0100 |
commit | 3249d35bdcd9a495af3277dfb4b2129d7ef80f15 (patch) | |
tree | aad517a164b6df760cb20e5dcf4827c180937a62 /app/models | |
parent | f18349640b686a3c3866711bfcd1d14edd5bc41a (diff) |
Improve account deletion performances further (#15407)
* Delete status records by batches of 50
* Do not precompute values that are only used once
* Do not generate redis events for removal of public toots older than two weeks
* Filter reported toots a priori for polls and status deletion
* Do not process reblogs when cleaning up public timelines
As in Mastodon proper, reblogs don't appear in public TLs
* Clean the deleted account's own feed in one go
* Refactor Account#clean_feed_manager and List#clean_feed_manager
* Delete instead of destroy a few more associations
* Fix preloading
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/account.rb | 13 | ||||
-rw-r--r-- | app/models/list.rb | 13 |
2 files changed, 2 insertions, 24 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index 80eb92a711b..e6cf03fa84e 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -578,17 +578,6 @@ class Account < ApplicationRecord end def clean_feed_manager - reblog_key = FeedManager.instance.key(:home, id, 'reblogs') - reblogged_id_set = Redis.current.zrange(reblog_key, 0, -1) - - Redis.current.pipelined do - Redis.current.del(FeedManager.instance.key(:home, id)) - Redis.current.del(reblog_key) - - reblogged_id_set.each do |reblogged_id| - reblog_set_key = FeedManager.instance.key(:home, id, "reblogs:#{reblogged_id}") - Redis.current.del(reblog_set_key) - end - end + FeedManager.instance.clean_feeds!(:home, [id]) end end diff --git a/app/models/list.rb b/app/models/list.rb index 655d55ff6fe..cdc6ebdb37a 100644 --- a/app/models/list.rb +++ b/app/models/list.rb @@ -34,17 +34,6 @@ class List < ApplicationRecord private def clean_feed_manager - reblog_key = FeedManager.instance.key(:list, id, 'reblogs') - reblogged_id_set = Redis.current.zrange(reblog_key, 0, -1) - - Redis.current.pipelined do - Redis.current.del(FeedManager.instance.key(:list, id)) - Redis.current.del(reblog_key) - - reblogged_id_set.each do |reblogged_id| - reblog_set_key = FeedManager.instance.key(:list, id, "reblogs:#{reblogged_id}") - Redis.current.del(reblog_set_key) - end - end + FeedManager.instance.clean_feeds!(:list, [id]) end end |