Duplication: LLC schedulers re-implement identical poll-loop scaffolding
Each LLC background scheduler hand-rolls the same start/stop/poll-loop lifecycle:
self._running flag, self._task: Optional[asyncio.Task], start() → asyncio.create_task(self._loop(), name=...), stop() → cancel task, is_running property, and _loop() → while self._running: <work>; await asyncio.sleep(self._poll_interval).
Verified near-identical across:
llc/scheduler/budget_watchdog.py
llc/scheduler/liveness_monitor.py
llc/scheduler/routine_scheduler.py
llc/scheduler/session_checkpointer.py
(heartbeat_scheduler.py is richer but follows the same shape.)
Proposed fix
Extract a PollLoopScheduler base (e.g. llc/scheduler/base.py) owning start/stop/is_running/_loop + a configurable poll interval and task name; subclasses implement only _check_once() (the per-tick work). Mirrors the SubprocessLifecycleAdapter consolidation (#9834).
Labels: enhancement · backend · priority: low
Duplication: LLC schedulers re-implement identical poll-loop scaffolding
Each LLC background scheduler hand-rolls the same start/stop/poll-loop lifecycle:
self._runningflag,self._task: Optional[asyncio.Task],start()→asyncio.create_task(self._loop(), name=...),stop()→ cancel task,is_runningproperty, and_loop()→while self._running: <work>; await asyncio.sleep(self._poll_interval).Verified near-identical across:
llc/scheduler/budget_watchdog.pyllc/scheduler/liveness_monitor.pyllc/scheduler/routine_scheduler.pyllc/scheduler/session_checkpointer.py(
heartbeat_scheduler.pyis richer but follows the same shape.)Proposed fix
Extract a
PollLoopSchedulerbase (e.g.llc/scheduler/base.py) owningstart/stop/is_running/_loop+ a configurable poll interval and task name; subclasses implement only_check_once()(the per-tick work). Mirrors theSubprocessLifecycleAdapterconsolidation (#9834).Labels: enhancement · backend · priority: low