mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-10-25 17:36:29 +08:00
fix: use a plain lock and trim comments in config save
Co-authored-by: cowagent <cow@cowagent.ai>
This commit is contained in:
1 parent
7e19a0e1c7
commit
fa376c1b16
1 file changed
+3
-5
@@ -33,7 +33,7 @@ from config import conf, get_data_root
|
||||
from models.reasoning_capabilities import provider_reasoning_metadata
|
||||
|
||||
|
||||
_settings_save_lock = threading.RLock()
|
||||
_settings_save_lock = threading.Lock()
|
||||
|
||||
|
||||
class ConfigHandler:
|
||||
@@ -175,8 +175,7 @@ class ConfigHandler:
|
||||
return json.dumps({"status": "error", "message": str(e)})
|
||||
|
||||
def POST(self):
|
||||
# Keep settings saves ordered through persistence and live publication.
|
||||
# Other config-writing endpoints retain their existing behavior.
|
||||
# Serialized so the file and the live config are updated in the same order.
|
||||
with _settings_save_lock:
|
||||
return self._save_settings()
|
||||
|
||||
@@ -242,8 +241,7 @@ class ConfigHandler:
|
||||
applied[section] = merged
|
||||
_write_config_file_for_write(config_path, file_cfg)
|
||||
|
||||
# A failed read or write must leave running settings (including
|
||||
# authentication) unchanged, just as it leaves the old file intact.
|
||||
# Publish only after the file is saved, so a failed save changes nothing.
|
||||
for key, value in applied.items():
|
||||
local_config[key] = value
|
||||
|
||||
|
||||
Reference in new issue
Block a user