Merge branch 'bw-todo-count-expiration' into 'master'

Todo count calculations now expired quicker for top bar stats

See merge request gitlab-org/gitlab-ce!15794
This commit is contained in:
Sean McGivern 2017-12-11 10:41:10 +00:00
commit 980df27189

View file

@ -1054,13 +1054,13 @@ class User < ActiveRecord::Base
end
def todos_done_count(force: false)
Rails.cache.fetch(['users', id, 'todos_done_count'], force: force) do
Rails.cache.fetch(['users', id, 'todos_done_count'], force: force, expires_in: 20.minutes) do
TodosFinder.new(self, state: :done).execute.count
end
end
def todos_pending_count(force: false)
Rails.cache.fetch(['users', id, 'todos_pending_count'], force: force) do
Rails.cache.fetch(['users', id, 'todos_pending_count'], force: force, expires_in: 20.minutes) do
TodosFinder.new(self, state: :pending).execute.count
end
end