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
6 changed files with 126 additions and 7 deletions

View File

@ -41,9 +41,10 @@ class SuspendAccountService < BaseService
end
def purge_profile!
@account.suspended = true
@account.display_name = ''
@account.note = ''
@account.suspended = true
@account.display_name = ''
@account.note = ''
@account.statuses_count = 0
@account.avatar.destroy
@account.header.destroy
@account.save!