From: Eugen Rochko Date: Mon, 30 Sep 2019 23:19:24 +0000 (+0200) Subject: Fix active user count for different number of weeks using same cache (#12025) X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=e682d3aa9e9c9219aa06f7ad5a4f1412b5ea2b4a;p=mastodon.git Fix active user count for different number of weeks using same cache (#12025) Fix #12003 --- diff --git a/app/presenters/instance_presenter.rb b/app/presenters/instance_presenter.rb index c4caeaa8c..c150bf742 100644 --- a/app/presenters/instance_presenter.rb +++ b/app/presenters/instance_presenter.rb @@ -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