From de5707686d80faf18034e86667454a4cce7b4bdc Mon Sep 17 00:00:00 2001 From: Cody Cutrer Date: Wed, 26 Aug 2020 14:27:35 -0600 Subject: [PATCH] cache feature_flag_account_ids in MultiCache for root accounts Change-Id: I70792d730178f948efd3031c4dad82120a88a7c2 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/246119 Tested-by: Service Cloud Jenkins Reviewed-by: Jacob Burroughs QA-Review: Cody Cutrer Product-Review: Cody Cutrer --- lib/feature_flags.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/feature_flags.rb b/lib/feature_flags.rb index d8aa5f1c397..7c246d8ba00 100644 --- a/lib/feature_flags.rb +++ b/lib/feature_flags.rb @@ -96,9 +96,10 @@ module FeatureFlags return [Account.site_admin.global_id] if is_a?(User) return [] if self.is_a?(Account) && self.site_admin? + cache = self.is_a?(Account) && root_account? ? MultiCache.cache : Rails.cache RequestCache.cache('feature_flag_account_ids', self) do shard.activate do - Rails.cache.fetch(['feature_flag_account_ids', self].cache_key) do + cache.fetch(['feature_flag_account_ids', self].cache_key) do chain = account_chain(include_site_admin: true) chain.shift if is_a?(Account) chain.reverse.map(&:global_id)