diff --git a/utils/statistics_server_v3.py b/utils/statistics_server_v3.py index 7d45482..88fb631 100644 --- a/utils/statistics_server_v3.py +++ b/utils/statistics_server_v3.py @@ -395,6 +395,8 @@ def fetch_full_log(): ''' GET request Parameters: 'exchange_name" -> string + + It trims the full log to 200 lines, to avoid sending too much data to the client. ''' if "X-API-KEY" in request.headers and request.headers.get("X-API-KEY") in valid_keys: try: @@ -402,11 +404,11 @@ def fetch_full_log(): width = 0 last_lines,amount_of_lines = last_n_lines(f"../logs/{exchange_name}.log",width,0,full_log=True) if not cache_requests: - return jsonify({"line": last_lines, "amount_of_lines": amount_of_lines}) + return jsonify({"line": last_lines[-200:], "amount_of_lines": amount_of_lines}) response_hash = hash(str({"line": last_lines, "amount_of_lines": amount_of_lines})) if hashes_db["fetch_full_log"]!=response_hash: hashes_db["fetch_full_log"] = response_hash - return jsonify({"line": last_lines, "amount_of_lines": amount_of_lines}) + return jsonify({"line": last_lines[-200:], "amount_of_lines": amount_of_lines}) return jsonify({"no_changes": True}) except Exception as e: print(e)