Update Python tools
This commit is contained in:
@@ -19,6 +19,7 @@ class BackgroundScheduler:
|
||||
self._stopped = threading.Event()
|
||||
self._lock = threading.Lock()
|
||||
self._next_due: dict[str, float] = {}
|
||||
self._next_cleanup = 0.0
|
||||
self._running: set[str] = set()
|
||||
self._thread: threading.Thread | None = None
|
||||
|
||||
@@ -40,6 +41,9 @@ class BackgroundScheduler:
|
||||
def _loop(self) -> None:
|
||||
while not self._stopped.is_set():
|
||||
current = time.monotonic()
|
||||
if current >= self._next_cleanup:
|
||||
self._next_cleanup = current + 60
|
||||
self.manager.cleanup_transient_files()
|
||||
for task in self.tasks:
|
||||
due = self._next_due.setdefault(task.id, current)
|
||||
if current >= due:
|
||||
|
||||
Reference in New Issue
Block a user