0
0
Fork 0

Remove expensive counters from federation page in admin UI (#11139)

This commit is contained in:
Eugen Rochko 2019-06-22 00:39:09 +02:00 committed by GitHub
parent 707ddf7808
commit 1b052c7b2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 16 deletions

View file

@ -11,12 +11,8 @@ class Instance
@domain_block = resource.is_a?(DomainBlock) ? resource : DomainBlock.rule_for(domain)
end
def cached_sample_accounts
Rails.cache.fetch("#{cache_key}/sample_accounts", expires_in: 12.hours) { Account.where(domain: domain).searchable.joins(:account_stat).popular.limit(3) }
end
def cached_accounts_count
@accounts_count || Rails.cache.fetch("#{cache_key}/count", expires_in: 12.hours) { Account.where(domain: domain).count }
def countable?
@accounts_count.present?
end
def to_param