commit: 9619b7f7278ed63ba2caaf6eaa1ef711d72c1918
parent: 66be6475b643009bb13c1de7b6225d659f9e5112
Author: Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
Date: Mon, 18 Sep 2017 21:59:57 +0900
Use Account.local.sum(statuses_count) instead of Status.local.count (#4996)
It is faster.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git 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