refactor(config): Defer import ofstart_config_service to reduce startup overhead
The import is now performed lazily within load_config to avoid early import errors and unnecessary loading during module initialization. - Enhancement: Lazy loading of configuration service - Bug Fix: Prevent ImportError when services.config is unavailable during startup
This commit is contained in:
1 file changed
+2
-1
+2
-1
@@ -2,7 +2,6 @@ import json
|
|||||||
|
|
||||||
from fabric.utils import Gdk, GLib, get_relative_path, os
|
from fabric.utils import Gdk, GLib, get_relative_path, os
|
||||||
|
|
||||||
from services.config import start_config_service
|
|
||||||
from utils.functions import parse_timeout_string
|
from utils.functions import parse_timeout_string
|
||||||
|
|
||||||
APP_NAME = "modus1"
|
APP_NAME = "modus1"
|
||||||
@@ -29,6 +28,8 @@ MATUGEN_STATE_FILE = os.path.join(CONFIG_DIR, "matugen")
|
|||||||
def load_config():
|
def load_config():
|
||||||
"""Load the configuration from config.json"""
|
"""Load the configuration from config.json"""
|
||||||
try:
|
try:
|
||||||
|
from services.config import start_config_service
|
||||||
|
|
||||||
service = start_config_service()
|
service = start_config_service()
|
||||||
return service.get_all()
|
return service.get_all()
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|||||||
Reference in new issue
Block a user