diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /lib/feature | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'lib/feature')
-rw-r--r-- | lib/feature/gitaly.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/feature/gitaly.rb b/lib/feature/gitaly.rb index 2d0fdf98e8c..e603a1dc8d2 100644 --- a/lib/feature/gitaly.rb +++ b/lib/feature/gitaly.rb @@ -5,25 +5,25 @@ class Feature PREFIX = "gitaly_" class << self - def enabled?(feature_flag) + def enabled?(feature_flag, project = nil) return false unless Feature::FlipperFeature.table_exists? - Feature.enabled?("#{PREFIX}#{feature_flag}") + Feature.enabled?("#{PREFIX}#{feature_flag}", project) rescue ActiveRecord::NoDatabaseError, PG::ConnectionBad false end - def server_feature_flags + def server_feature_flags(project = nil) # We need to check that both the DB connection and table exists return {} unless ::Gitlab::Database.cached_table_exists?(FlipperFeature.table_name) Feature.persisted_names .select { |f| f.start_with?(PREFIX) } - .map do |f| + .to_h do |f| flag = f.delete_prefix(PREFIX) - ["gitaly-feature-#{flag.tr('_', '-')}", enabled?(flag).to_s] - end.to_h + ["gitaly-feature-#{flag.tr('_', '-')}", enabled?(flag, project).to_s] + end end end end |