about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>2017-09-18 21:59:57 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-09-18 14:59:57 +0200
commit9619b7f7278ed63ba2caaf6eaa1ef711d72c1918 (patch)
tree8c34ea53e86f7e755c40efb7d8040a15ad55eeba
parent66be6475b643009bb13c1de7b6225d659f9e5112 (diff)
Use Account.local.sum(statuses_count) instead of Status.local.count (#4996)
It is faster.
-rw-r--r--app/presenters/instance_presenter.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/presenters/instance_presenter.rb b/app/presenters/instance_presenter.rb
index c9e3c31a1..4c1124d59 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