mirror of
https://github.com/frappe/frappe.git
synced 2024-06-12 22:22:25 +00:00
fix(setup_module_map): fix caching
Use a separate cache key depending on the arguments passed Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
parent
3237abdc7b
commit
e6be7d6648
|
@ -1699,11 +1699,19 @@ def append_hook(target, key, value):
|
|||
target[key].extend(value)
|
||||
|
||||
|
||||
def setup_module_map(include_all_apps=True):
|
||||
"""Rebuild map of all modules (internal)."""
|
||||
if conf.db_name:
|
||||
def setup_module_map(include_all_apps: bool = True) -> None:
|
||||
"""
|
||||
Function to rebuild map of all modules
|
||||
|
||||
:param: include_all_apps: Include all apps on bench, or just apps installed on the site.
|
||||
:return: Nothing
|
||||
"""
|
||||
if include_all_apps:
|
||||
local.app_modules = cache.get_value("app_modules")
|
||||
local.module_app = cache.get_value("module_app")
|
||||
else:
|
||||
local.app_modules = cache.get_value("installed_app_modules")
|
||||
local.module_app = cache.get_value("module_installed_app")
|
||||
|
||||
if not (local.app_modules and local.module_app):
|
||||
local.module_app, local.app_modules = {}, {}
|
||||
|
@ -1722,9 +1730,12 @@ def setup_module_map(include_all_apps=True):
|
|||
local.module_app[module] = app
|
||||
local.app_modules[app].append(module)
|
||||
|
||||
if conf.db_name:
|
||||
if include_all_apps:
|
||||
cache.set_value("app_modules", local.app_modules)
|
||||
cache.set_value("module_app", local.module_app)
|
||||
else:
|
||||
cache.set_value("installed_app_modules", local.app_modules)
|
||||
cache.set_value("module_installed_app", local.module_app)
|
||||
|
||||
|
||||
def get_file_items(path, raise_not_found=False, ignore_empty_lines=True):
|
||||
|
|
|
@ -26,7 +26,9 @@ global_cache_keys = (
|
|||
"installed_apps",
|
||||
"all_apps",
|
||||
"app_modules",
|
||||
"installed_app_modules",
|
||||
"module_app",
|
||||
"module_installed_app",
|
||||
"system_settings",
|
||||
"scheduler_events",
|
||||
"time_zone",
|
||||
|
|
Loading…
Reference in New Issue
Block a user