Skip to content

Commit

Permalink
chg: [config] queries limit
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidCruciani committed Mar 11, 2024
1 parent 99e2ce7 commit dcc790f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions website/app/session_class.py
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
5 changes: 4 additions & 1 deletion website/app/utils/utils.py
Expand Up @@ -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)
config.write(conffile)

def get_limit_queries():
return Config.QUERIES_LIMIT
2 changes: 2 additions & 0 deletions website/conf/config.py
Expand Up @@ -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
Expand Down

0 comments on commit dcc790f

Please sign in to comment.