perf: Glob filesystem instead of DB reads etc
Why speak more word when less word do trick
This commit is contained in:
parent
67478e25c3
commit
c9fa6931ff
1 changed files with 5 additions and 10 deletions
|
|
@ -105,17 +105,12 @@ def sync_customizations(app: Optional[str] = None):
|
|||
apps = frappe.get_installed_apps() if not app else [app]
|
||||
|
||||
for app_name in apps:
|
||||
for module_name in frappe.local.app_modules.get(app_name) or []:
|
||||
module_custom_folder = frappe.get_app_path(app_name, module_name, "custom")
|
||||
if not os.path.exists(module_custom_folder):
|
||||
continue
|
||||
for json_file in glob(frappe.get_app_path(app_name, "**", "custom", "*.json")):
|
||||
with open(json_file, "r") as f:
|
||||
data = json.loads(f.read())
|
||||
|
||||
for json_file in glob(os.path.join(module_custom_folder, "*.json")):
|
||||
with open(os.path.join(module_custom_folder, json_file), "r") as f:
|
||||
data = json.loads(f.read())
|
||||
|
||||
if data.get("sync_on_migrate"):
|
||||
sync_customizations_for_doctype(data, module_custom_folder)
|
||||
if data.get("sync_on_migrate"):
|
||||
sync_customizations_for_doctype(data, os.path.dirname(json_file))
|
||||
|
||||
|
||||
def sync_customizations_for_doctype(data: Dict, folder: str):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue