From fbc9fcee7ec4813fcdb2991e0d04bbb7c3e8c964 Mon Sep 17 00:00:00 2001 From: Pedro Berdasco <106992009+agueybanapr@users.noreply.github.com> Date: Tue, 15 Sep 2026 08:33:48 +0000 Subject: [PATCH] Refactor config import logic for legacy column references Ensure legacy column references are renamed only if the config file has changed. Fix unnecessary config scan in importConfigs, was causing the container to run at over 80% CPU. QA tested locally, all test passed! --- server/initialise.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/initialise.py b/server/initialise.py index 7325f6bc..fdbe4132 100755 --- a/server/initialise.py +++ b/server/initialise.py @@ -230,17 +230,14 @@ def importConfigs(pm, db, all_plugins): # get config file name config_file = Path(fullConfPath) - # Only import file if the file was modifed since last import. + # Only import file if the file was modified since last import. # this avoids time zone issues as we just compare the previous timestamp to the current time stamp # rename settings that have changed names due to code cleanup and migration to plugins # renameSettings(config_file) - # rename legacy DB column references in user config values (e.g. templates, WATCH lists) - renameColumnReferences(config_file) - fileModifiedTime = os.path.getmtime(config_file) - + mylog("debug", ["[Import Config] checking config file "]) mylog("debug", ["[Import Config] lastImportedConfFile :", conf.lastImportedConfFile],) mylog("debug", ["[Import Config] fileModifiedTime :", fileModifiedTime]) @@ -249,6 +246,9 @@ def importConfigs(pm, db, all_plugins): mylog("debug", ["[Import Config] skipping config file import"]) return pm, all_plugins, False + # rename legacy column references only when the config file actually changed + renameColumnReferences(config_file) + # Header updateState("Import config", showSpinner=True)