From cb6e243643b702d027f0cc928583e50a019b18b1 Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Wed, 31 Jul 2024 15:05:49 +0200 Subject: [PATCH 1/3] chore(bundle): update flipper 1.2.2 => 1.3.0 --- Gemfile.lock | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index cafeb4063e6..b8190eb74ab 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -174,7 +174,7 @@ GEM clamav-client (3.2.0) coercible (1.0.0) descendants_tracker (~> 0.0.1) - concurrent-ruby (1.3.1) + concurrent-ruby (1.3.3) connection_pool (2.4.1) content_disposition (1.0.0) crack (1.0.0) @@ -234,7 +234,7 @@ GEM dumb_delegator (1.0.0) email_validator (2.2.4) activemodel - erubi (1.12.0) + erubi (1.13.0) et-orbi (1.2.11) tzinfo ethon (0.16.0) @@ -252,19 +252,20 @@ GEM faraday-net_http (3.1.0) net-http ffi (1.16.3) - flipper (1.2.2) + flipper (1.3.0) concurrent-ruby (< 2) - flipper-active_record (1.2.2) + flipper-active_record (1.3.0) activerecord (>= 4.2, < 8) - flipper (~> 1.2.2) - flipper-active_support_cache_store (1.2.2) + flipper (~> 1.3.0) + flipper-active_support_cache_store (1.3.0) activesupport (>= 4.2, < 8) - flipper (~> 1.2.2) - flipper-ui (1.2.2) + flipper (~> 1.3.0) + flipper-ui (1.3.0) erubi (>= 1.0.0, < 2.0.0) - flipper (~> 1.2.2) + flipper (~> 1.3.0) rack (>= 1.4, < 4) - rack-protection (>= 1.5.3, <= 4.0.0) + rack-protection (>= 1.5.3, < 5.0.0) + rack-session (>= 1.0.2, < 3.0.0) sanitize (< 7) fog-core (2.4.0) builder @@ -509,7 +510,7 @@ GEM pundit (2.3.1) activesupport (>= 3.0.0) raabro (1.4.0) - racc (1.8.0) + racc (1.8.1) rack (2.2.9) rack-attack (6.7.0) rack (>= 1.0, < 4) @@ -527,6 +528,8 @@ GEM rack (~> 2.2, >= 2.2.4) rack-proxy (0.7.7) rack + rack-session (1.0.2) + rack (< 3) rack-test (2.1.0) rack (>= 1.3) rack_session_access (0.2.0) @@ -677,7 +680,7 @@ GEM nokogiri (>= 1.6.2) rexml xmlenc (>= 0.7.1) - sanitize (6.1.0) + sanitize (6.1.2) crass (~> 1.0.2) nokogiri (>= 1.12.0) sass (3.7.4) From a316600e7aab6647a76990da7e3420835f8c5868 Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Wed, 31 Jul 2024 15:58:20 +0200 Subject: [PATCH 2/3] chore(flipper): update config for flipper 1.3 --- config/initializers/flipper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/initializers/flipper.rb b/config/initializers/flipper.rb index a027582b2f8..1ad209aa135 100644 --- a/config/initializers/flipper.rb +++ b/config/initializers/flipper.rb @@ -52,12 +52,13 @@ def database_exists? Flipper::Adapters::ActiveSupportCacheStore.new( Flipper::Adapters::ActiveRecord.new, ActiveSupport::Cache::MemoryStore.new, - expires_in: 10.seconds + 10.seconds ) end end Rails.application.configure do + config.flipper.actor_limit = 500 # default is 100 but hide_instructeur_email feature has ~478 # don't preload features for /assets/* but do for everything else config.flipper.preload = -> (request) { !request.path.start_with?('/assets/', '/ping') } config.flipper.strict = Rails.env.development? From 99fd12beb8413633974c273304b74dfa9a7acdce Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Wed, 31 Jul 2024 16:05:45 +0200 Subject: [PATCH 3/3] fix(flipper): really setup missing (not enabled) feature --- config/initializers/flipper.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/config/initializers/flipper.rb b/config/initializers/flipper.rb index 1ad209aa135..6d2a932c875 100644 --- a/config/initializers/flipper.rb +++ b/config/initializers/flipper.rb @@ -6,7 +6,7 @@ require 'flipper/adapters/active_support_cache_store' def setup_features(features) - existing = Flipper.preload(features).map { _1.name.to_sym } + existing = Flipper.preload_all.map { _1.name.to_sym } missing = features - existing missing.each do |feature| @@ -41,12 +41,6 @@ def database_exists? false end -ActiveSupport.on_load(:active_record) do - if database_exists? && ActiveRecord::Base.connection.data_source_exists?('flipper_features') - setup_features(features) - end -end - Flipper.configure do |config| config.adapter do Flipper::Adapters::ActiveSupportCacheStore.new( @@ -57,6 +51,12 @@ def database_exists? end end +ActiveSupport.on_load(:active_record) do + if database_exists? && ActiveRecord::Base.connection.data_source_exists?('flipper_features') + setup_features(features) + end +end + Rails.application.configure do config.flipper.actor_limit = 500 # default is 100 but hide_instructeur_email feature has ~478 # don't preload features for /assets/* but do for everything else