From 9619b7f7278ed63ba2caaf6eaa1ef711d72c1918 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Mon, 18 Sep 2017 21:59:57 +0900 Subject: [PATCH] Use Account.local.sum(statuses_count) instead of Status.local.count (#4996) It is faster. --- app/presenters/instance_presenter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/presenters/instance_presenter.rb b/app/presenters/instance_presenter.rb index c9e3c31a16..4c1124d599 100644 --- a/app/presenters/instance_presenter.rb +++ b/app/presenters/instance_presenter.rb @@ -21,7 +21,7 @@ class InstancePresenter end def status_count - Rails.cache.fetch('local_status_count') { Status.local.count } + Rails.cache.fetch('local_status_count') { Account.local.sum(:statuses_count) } end def domain_count