INNER CODE UNIT · Python

_periodic_log_retention

av1155/houndarr · src/houndarr/app.py:40

async def _periodic_log_retention(retention_days: int) -> None:
    """Periodically purge old search_log rows during app uptime.

    The supervisor task fires once every 24 hours and respects
    ``log_retention_days`` from :class:`AppSettings`.  When the value is
    ``0`` the lifespan never spawns this task (see :func:`_lifespan`).
    """
    while True:
        await asyncio.sleep(_LOG_RETENTION_INTERVAL_SECONDS)
        try:
            purged = await purge_old_logs(retention_days)
            if purged > 0:
                logger.info(
                    "Periodic retention purged %d search_log rows older than %d days",
                    purged,
                    retention_days,
                )
            # Refresh sqlite_stat1 so the planner reflects the post-purge

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…