]> cat aescling's git repositories - mastodon.git/commitdiff
Fix active user count for different number of weeks using same cache (#12025)
authorEugen Rochko <eugen@zeonfederated.com>
Mon, 30 Sep 2019 23:19:24 +0000 (01:19 +0200)
committerGitHub <noreply@github.com>
Mon, 30 Sep 2019 23:19:24 +0000 (01:19 +0200)
Fix #12003

app/presenters/instance_presenter.rb

index c4caeaa8c10450f28bd3deddcf5f689d9589d81c..c150bf742be5799816de757aa6d0795326dddaff 100644 (file)
@@ -21,7 +21,7 @@ class InstancePresenter
   end
 
   def active_user_count(weeks = 4)
-    Rails.cache.fetch('active_user_count') { Redis.current.pfcount(*(0...weeks).map { |i| "activity:logins:#{i.weeks.ago.utc.to_date.cweek}" }) }
+    Rails.cache.fetch("active_user_count/#{weeks}") { Redis.current.pfcount(*(0...weeks).map { |i| "activity:logins:#{i.weeks.ago.utc.to_date.cweek}" }) }
   end
 
   def status_count