From 97611c88fcbae6b025750e6ebf2061a3d87d9753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Fri, 7 Jul 2017 02:34:51 +0200 Subject: Don't use Flipper for the Performance Bar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The implementation now simply rely on the `performance_bar_allowed_group_id` Application Setting. Signed-off-by: Rémy Coutable --- lib/feature.rb | 8 -------- lib/gitlab/performance_bar.rb | 13 +++---------- 2 files changed, 3 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/feature.rb b/lib/feature.rb index c4e1741df52..363f66ba60e 100644 --- a/lib/feature.rb +++ b/lib/feature.rb @@ -57,13 +57,5 @@ class Feature Flipper.new(adapter) end end - - def register_feature_groups - Flipper.register(:performance_team) do |actor| - user = actor.thing - - user&.is_a?(User) && Gitlab::PerformanceBar.allowed_user?(user) - end - end end end diff --git a/lib/gitlab/performance_bar.rb b/lib/gitlab/performance_bar.rb index aa033571de0..2da2ce45ebc 100644 --- a/lib/gitlab/performance_bar.rb +++ b/lib/gitlab/performance_bar.rb @@ -3,16 +3,9 @@ module Gitlab include Gitlab::CurrentSettings ALLOWED_USER_IDS_KEY = 'performance_bar_allowed_user_ids'.freeze - # The time (in seconds) after which a set of allowed user IDs is expired - # automatically. - ALLOWED_USER_IDS_TIME_TO_LIVE = 10.minutes - def self.enabled?(current_user = nil) - Feature.enabled?(:performance_bar, current_user) - end - - def self.allowed_user?(user) - return false unless allowed_group_id + def self.enabled?(user = nil) + return false unless user && allowed_group_id allowed_user_ids.include?(user.id) end @@ -22,7 +15,7 @@ module Gitlab end def self.allowed_user_ids - Rails.cache.fetch(ALLOWED_USER_IDS_KEY, expires_in: ALLOWED_USER_IDS_TIME_TO_LIVE) do + Rails.cache.fetch(ALLOWED_USER_IDS_KEY) do group = Group.find_by_id(allowed_group_id) if group -- cgit v1.2.1