Commit b2a1919c authored by Brett Walker's avatar Brett Walker

expire todo count calculations to be consistent with

assigned_open_merge_requests_count and assigned_open_issues_count, which are used in the top header stats.  Also important for a Geo secondary, so that the pending todo stat gets updated on the same frequency as the users open issues/merge requests.
parent 9429e8ac
...@@ -1054,13 +1054,13 @@ class User < ActiveRecord::Base ...@@ -1054,13 +1054,13 @@ class User < ActiveRecord::Base
end end
def todos_done_count(force: false) 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 TodosFinder.new(self, state: :done).execute.count
end end
end end
def todos_pending_count(force: false) 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 TodosFinder.new(self, state: :pending).execute.count
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment