From c7c36a2f4bf2465e7347f2acf33d9cd00abec3dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Diot?= Date: Fri, 7 Jun 2024 12:25:13 +0100 Subject: [PATCH] Fix shenanigans with scheduler overriding UI config at restart --- src/common/db/Database.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/common/db/Database.py b/src/common/db/Database.py index 348bbd26d..f5c173331 100644 --- a/src/common/db/Database.py +++ b/src/common/db/Database.py @@ -1306,8 +1306,7 @@ class Database: changed_plugins.add(setting.plugin_id) to_put.append(Services_settings(service_id=server_name, setting_id=key, value=value, suffix=suffix, method=method)) elif ( - method == service_setting.method - or (service_setting.method not in ("scheduler", "autoconf") and method in ("scheduler", "autoconf")) + method == service_setting.method or (service_setting.method not in ("scheduler", "autoconf") and method == "autoconf") ) and service_setting.value != value: changed_plugins.add(setting.plugin_id) query = session.query(Services_settings).filter( @@ -1339,7 +1338,7 @@ class Database: changed_plugins.add(setting.plugin_id) to_put.append(Global_values(setting_id=key, value=value, suffix=suffix, method=method)) elif ( - method == global_value.method or (global_value.method not in ("scheduler", "autoconf") and method in ("scheduler", "autoconf")) + method == global_value.method or (global_value.method not in ("scheduler", "autoconf") and method == "autoconf") ) and global_value.value != value: changed_plugins.add(setting.plugin_id) query = session.query(Global_values).filter(Global_values.setting_id == key, Global_values.suffix == suffix) @@ -1384,7 +1383,7 @@ class Database: changed_plugins.add(setting.plugin_id) to_put.append(Global_values(setting_id=key, value=value, suffix=suffix, method=method)) elif ( - method == global_value.method or (global_value.method not in ("scheduler", "autoconf") and method in ("scheduler", "autoconf")) + method == global_value.method or (global_value.method not in ("scheduler", "autoconf") and method == "autoconf") ) and value != global_value.value: changed_plugins.add(setting.plugin_id) query = session.query(Global_values).filter(Global_values.setting_id == key, Global_values.suffix == suffix) @@ -1489,7 +1488,7 @@ class Database: if not custom_conf: to_put.append(Custom_configs(**custom_config)) elif custom_config["checksum"] != custom_conf.checksum and ( - method == custom_conf.method or (custom_conf.method not in ("scheduler", "autoconf") and method in ("scheduler", "autoconf")) + method == custom_conf.method or (custom_conf.method not in ("scheduler", "autoconf") and method == "autoconf") ): custom_conf.data = custom_config["data"] custom_conf.checksum = custom_config["checksum"]