INNER CODE UNIT · Python
_cleanup_history
MichielMe/fastscheduler · src/fastscheduler/main.py:284
def _cleanup_history(self):
"""Clean up old history entries based on count and age limits."""
if self.history_retention_days > 0:
cutoff_time = time.time() - (self.history_retention_days * 86400)
self.history = [h for h in self.history if h.timestamp >= cutoff_time]
if len(self.history) > self.max_history:
self.history = self.history[-self.max_history :]
def start(self):
"""Start the scheduler."""
if self.running:
logger.warning("Scheduler already running")
return
self.running = True
self.stats["start_time"] = time.time()