0
0
Fork 0

Improve counter caches on Status and Account (#7644)

Do not touch statuses_count on accounts table when mass-destroying
statuses to reduce load when removing accounts, same for
reblogs_count and favourites_count

Do not count statuses with direct visibility in statuses_count

Fix #828
This commit is contained in:
Eugen Rochko 2018-05-30 02:50:23 +02:00 committed by GitHub
parent 461542784b
commit a7d726c383
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 126 additions and 7 deletions

View file

@ -21,7 +21,10 @@ class BatchedRemoveStatusService < BaseService
@activity_xml = {}
# Ensure that rendered XML reflects destroyed state
statuses.each(&:destroy)
statuses.each do |status|
status.mark_for_mass_destruction!
status.destroy
end
# Batch by source account
statuses.group_by(&:account_id).each_value do |account_statuses|