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 <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2020-08-26 14:27:35 -06:00
parent d805bba4d3
commit de5707686d
1 changed files with 2 additions and 1 deletions

View File

@ -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)