From dcc790f5afa7118fff3e0a7f5bee3a6ef4417373 Mon Sep 17 00:00:00 2001 From: David Cruciani Date: Mon, 11 Mar 2024 15:27:25 +0100 Subject: [PATCH] chg: [config] queries limit --- website/app/session_class.py | 4 ++-- website/app/utils/utils.py | 5 ++++- website/conf/config.py | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/website/app/session_class.py b/website/app/session_class.py index ba988f5f..2e32cab2 100644 --- a/website/app/session_class.py +++ b/website/app/session_class.py @@ -3,7 +3,7 @@ from queue import Queue from threading import Thread from uuid import uuid4 -from .utils.utils import query_post_query, query_get_module, get_object +from .utils.utils import query_post_query, query_get_module, get_object, get_limit_queries from . import home_core as HomeModel import uuid from . import db @@ -179,7 +179,7 @@ def save_info(self): histories = History.query.all() - while len(histories) > 200: + while len(histories) > get_limit_queries(): history = History.query.order_by(History.id).all() session = Session_db.query.filter_by(id=history[0].session_id) if not History_Tree.query.filter_by(session_uuid=session.uuid): diff --git a/website/app/utils/utils.py b/website/app/utils/utils.py index 12a649dd..8476894f 100644 --- a/website/app/utils/utils.py +++ b/website/app/utils/utils.py @@ -71,4 +71,7 @@ def gen_admin_password(): print(f"##########################\n## Admin password ##\n## {password} ##\n##########################") config["ADMIN"]["ADMIN_PASSWORD"] = password with open(CONF_PATH, "w") as conffile: - config.write(conffile) \ No newline at end of file + config.write(conffile) + +def get_limit_queries(): + return Config.QUERIES_LIMIT \ No newline at end of file diff --git a/website/conf/config.py b/website/conf/config.py index bb49a8a2..3ab9666d 100644 --- a/website/conf/config.py +++ b/website/conf/config.py @@ -4,6 +4,8 @@ class Config: FLASK_URL = '127.0.0.1' FLASK_PORT = 7008 MISP_MODULE = '127.0.0.1:6666' + + QUERIES_LIMIT = 200 class DevelopmentConfig(Config): DEBUG = True