From 0882c0fa9724f418636478341112c4bb829a01cc Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Tue, 30 Sep 2025 19:27:43 +0200 Subject: [PATCH] Core: only store persistent changes if there are changes (#5311) --- Utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Utils.py b/Utils.py index d8dab4fcb0..a14e737c28 100644 --- a/Utils.py +++ b/Utils.py @@ -323,11 +323,13 @@ def get_options() -> Settings: return get_settings() -def persistent_store(category: str, key: str, value: typing.Any): - path = user_path("_persistent_storage.yaml") +def persistent_store(category: str, key: str, value: typing.Any, force_store: bool = False): storage = persistent_load() + if not force_store and category in storage and key in storage[category] and storage[category][key] == value: + return # no changes necessary category_dict = storage.setdefault(category, {}) category_dict[key] = value + path = user_path("_persistent_storage.yaml") with open(path, "wt") as f: f.write(dump(storage, Dumper=Dumper))