INNER CODE UNIT · Python
_stop_claude_mirror
ohdearquant/lionagi · lionagi/studio/app.py:155
async def _stop_claude_mirror(stop: asyncio.Event | None, task: asyncio.Task | None) -> None:
"""Signal the mirror tail to stop and await it, cancelling as a backstop."""
if stop is None or task is None:
return
stop.set()
try:
await asyncio.wait_for(task, timeout=10)
except (asyncio.TimeoutError, TimeoutError):
task.cancel()
with suppress(asyncio.CancelledError, Exception):
await task
except Exception: # noqa: BLE001
# a failed tail must not block shutdown
_log.warning("Claude mirror tail ended with error", exc_info=True)
async def _startup_warmup() -> None:
"""Deferred WAL checkpoint, off the critical path so /health serves as