fix(monitor): Maintain MAX_LOG entries in cache
This commit is contained in:
parent
af3c4feb64
commit
96d9f2624b
1 changed files with 4 additions and 5 deletions
|
|
@ -81,11 +81,10 @@ class Monitor:
|
|||
|
||||
|
||||
def store(json_data):
|
||||
if frappe.cache().llen(MONITOR_REDIS_KEY) >= 1000000:
|
||||
frappe.cache().ltrim(MONITOR_REDIS_KEY, len(logs) - 1, -1)
|
||||
frappe.cache().rpush(MONITOR_REDIS_KEY, json_data)
|
||||
else:
|
||||
frappe.cache().rpush(MONITOR_REDIS_KEY, json_data)
|
||||
MAX_LOGS = 1000000
|
||||
if frappe.cache().llen(MONITOR_REDIS_KEY) > MAX_LOGS:
|
||||
frappe.cache().ltrim(MONITOR_REDIS_KEY, 1, -1)
|
||||
frappe.cache().rpush(MONITOR_REDIS_KEY, json_data)
|
||||
|
||||
|
||||
def flush():
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue