add request cache around feature_flag_account_ids
gets called multiple times per request Change-Id: Id630760d1b34724d3d089e7dd48ad1c8268078b8 Reviewed-on: https://gerrit.instructure.com/82632 Tested-by: Jenkins Reviewed-by: Jeremy Stanley <jeremy@instructure.com> Product-Review: James Williams <jamesw@instructure.com> QA-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
parent
4e729f8fe9
commit
304667fa85
|
@ -77,14 +77,16 @@ module FeatureFlags
|
|||
# each account that needs to be searched for a feature flag, in priority order,
|
||||
# starting with site admin
|
||||
def feature_flag_account_ids
|
||||
Rails.cache.fetch(['feature_flag_account_ids', self].cache_key) do
|
||||
if is_a?(User)
|
||||
chain = [Account.site_admin]
|
||||
else
|
||||
chain = account_chain(include_site_admin: true)
|
||||
chain.shift if is_a?(Account)
|
||||
RequestCache.cache('feature_flag_account_ids', self) do
|
||||
Rails.cache.fetch(['feature_flag_account_ids', self].cache_key) do
|
||||
if is_a?(User)
|
||||
chain = [Account.site_admin]
|
||||
else
|
||||
chain = account_chain(include_site_admin: true)
|
||||
chain.shift if is_a?(Account)
|
||||
end
|
||||
chain.reverse.map(&:global_id)
|
||||
end
|
||||
chain.reverse.map(&:global_id)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue