full log limited to 200 entries
This commit is contained in:
parent
b540916a53
commit
61f9e8bc04
|
|
@ -395,6 +395,8 @@ def fetch_full_log():
|
||||||
'''
|
'''
|
||||||
GET request
|
GET request
|
||||||
Parameters: 'exchange_name" -> string
|
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:
|
if "X-API-KEY" in request.headers and request.headers.get("X-API-KEY") in valid_keys:
|
||||||
try:
|
try:
|
||||||
|
|
@ -402,11 +404,11 @@ def fetch_full_log():
|
||||||
width = 0
|
width = 0
|
||||||
last_lines,amount_of_lines = last_n_lines(f"../logs/{exchange_name}.log",width,0,full_log=True)
|
last_lines,amount_of_lines = last_n_lines(f"../logs/{exchange_name}.log",width,0,full_log=True)
|
||||||
if not cache_requests:
|
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}))
|
response_hash = hash(str({"line": last_lines, "amount_of_lines": amount_of_lines}))
|
||||||
if hashes_db["fetch_full_log"]!=response_hash:
|
if hashes_db["fetch_full_log"]!=response_hash:
|
||||||
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})
|
return jsonify({"no_changes": True})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue