From e7f605327fba4e946bdefa760afdbe4955790083 Mon Sep 17 00:00:00 2001 From: Arksine Date: Mon, 22 Mar 2021 11:45:15 -0400 Subject: [PATCH] history: set maximum jobs stored to 10000 Signed-off-by: Eric Callahan --- moonraker/components/history.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/moonraker/components/history.py b/moonraker/components/history.py index 9839d70..eb1fb9d 100644 --- a/moonraker/components/history.py +++ b/moonraker/components/history.py @@ -5,6 +5,7 @@ import logging import time HIST_NAMESPACE = "history" +MAX_JOBS = 10000 class History: def __init__(self, config): @@ -161,6 +162,8 @@ class History: ps['state'] != "paused" def add_job(self, job): + if len(self.cached_job_ids) >= MAX_JOBS: + self.delete_job(self.cached_job_ids[0]) job_id = f"{self.next_job_id:06X}" self.current_job = job self.current_job_id = job_id