From 01ab7ff1510fb2afd4b400e0a30a3abf6db88591 Mon Sep 17 00:00:00 2001 From: minecraft1024a Date: Sat, 1 Nov 2025 16:44:49 +0800 Subject: [PATCH] =?UTF-8?q?perf(storage):=20=E9=99=8D=E4=BD=8E=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E5=AD=98=E5=82=A8=E7=9A=84=E5=BB=B6=E8=BF=9F=E5=86=99?= =?UTF-8?q?=E5=85=A5=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将插件存储的 `save_delay` 从 5 秒调整为 2 秒,以更快地将数据持久化到磁盘,减少因意外关闭导致数据丢失的风险,同时在可接受的范围内平衡了性能开销。 --- src/plugin_system/apis/storage_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugin_system/apis/storage_api.py b/src/plugin_system/apis/storage_api.py index 61a41b7ef..66c7d4e79 100644 --- a/src/plugin_system/apis/storage_api.py +++ b/src/plugin_system/apis/storage_api.py @@ -78,7 +78,7 @@ class PluginStorage: # --- 延迟写入新增属性 --- self._dirty = False # 数据是否被修改过的标志 self._write_timer: threading.Timer | None = None # 延迟写入的计时器 - self.save_delay = 5 # 延迟5秒写入 + self.save_delay = 2 # 延迟2秒写入 self._ensure_directory_exists() self._load_data()