From b4dcf8859e1247bbf06505c47c46fec63bfd0ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E9=9B=AA=E5=B3=B0?= Date: Fri, 29 Dec 2023 13:54:10 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=90=AF=E5=90=8E=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=9C=80=E5=A4=A7=E6=95=B0=E9=87=8F=E8=A2=AB?= =?UTF-8?q?=E9=87=8D=E7=BD=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- easyapi/api.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/easyapi/api.py b/easyapi/api.py index 5b4207a..def8051 100644 --- a/easyapi/api.py +++ b/easyapi/api.py @@ -7,7 +7,7 @@ import execution extension_folder = os.path.dirname(os.path.realpath(__file__)) -def reset_history_size(max_size=execution.MAXIMUM_HISTORY_SIZE): +def reset_history_size(max_size=execution.MAXIMUM_HISTORY_SIZE, isStart=False): configDataFilePath = os.path.join(extension_folder, 'config') if not os.path.exists(configDataFilePath): os.mkdir(configDataFilePath) @@ -22,7 +22,8 @@ def reset_history_size(max_size=execution.MAXIMUM_HISTORY_SIZE): else: with open(configFile, 'r+', encoding="UTF-8") as file: data = json.load(file) - data['history_max_size'] = max_size + if not isStart: + data['history_max_size'] = max_size with open(configFile, 'w+', encoding="UTF-8") as file: json.dump(data, file, indent=2) @@ -63,6 +64,6 @@ def register_routes(): def init(): - reset_history_size() + reset_history_size(isStart=True) register_routes()