Skip to content
Snippets Groups Projects

Feature flag default on catfile cache

All threads resolved!
6 files
+ 31
10
Compare changes
  • Side-by-side
  • Inline
Files
6
+ 9
1
 
# frozen_string_literal: true
 
 
require 'set'
 
class Feature
class Feature
class Gitaly
class Gitaly
CATFILE_CACHE = 'catfile-cache'.freeze
CATFILE_CACHE = 'catfile-cache'.freeze
# Server feature flags should use '_' to separate words.
# Server feature flags should use '_' to separate words.
SERVER_FEATURE_FLAGS = [CATFILE_CACHE].freeze
SERVER_FEATURE_FLAGS = [CATFILE_CACHE].freeze
 
DEFAULT_ON_FLAGS = Set.new([CATFILE_CACHE]).freeze
class << self
class << self
def enabled?(feature_flag)
def enabled?(feature_flag)
Feature::FlipperFeature.table_exists? && Feature.enabled?("gitaly_#{feature_flag}")
return false unless Feature::FlipperFeature.table_exists?
 
 
default_on = DEFAULT_ON_FLAGS.include?(feature_flag)
 
Feature.enabled?("gitaly_#{feature_flag}", default_enabled: default_on)
rescue ActiveRecord::NoDatabaseError
rescue ActiveRecord::NoDatabaseError
false
false
end
end
Loading