Commit c64fd519 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'fix-performance-bar-cached-user-ids' into 'master'

Expire cached user IDs that can see the performance after 5 minutes

See merge request !12911
parents 15fda22c 7cbdaef4
...@@ -2,7 +2,8 @@ module Gitlab ...@@ -2,7 +2,8 @@ module Gitlab
module PerformanceBar module PerformanceBar
include Gitlab::CurrentSettings include Gitlab::CurrentSettings
ALLOWED_USER_IDS_KEY = 'performance_bar_allowed_user_ids'.freeze ALLOWED_USER_IDS_KEY = 'performance_bar_allowed_user_ids:v2'.freeze
EXPIRY_TIME = 5.minutes
def self.enabled?(user = nil) def self.enabled?(user = nil)
return false unless user && allowed_group_id return false unless user && allowed_group_id
...@@ -15,7 +16,7 @@ module Gitlab ...@@ -15,7 +16,7 @@ module Gitlab
end end
def self.allowed_user_ids def self.allowed_user_ids
Rails.cache.fetch(ALLOWED_USER_IDS_KEY) do Rails.cache.fetch(ALLOWED_USER_IDS_KEY, expires_in: EXPIRY_TIME) do
group = Group.find_by_id(allowed_group_id) group = Group.find_by_id(allowed_group_id)
if group if group
......
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