diff --git a/backend/app/services/scanner.py b/backend/app/services/scanner.py index f55ac25..3aa9b07 100644 --- a/backend/app/services/scanner.py +++ b/backend/app/services/scanner.py @@ -8,7 +8,7 @@ from sqlalchemy import select from app.database import AsyncSessionLocal from app.models import SourceRoot -from app.tasks.scan import scan_all_source_roots, watch_folders +from app.tasks.scan import scan_all_source_roots from app.config import settings logger = logging.getLogger(__name__) @@ -49,15 +49,17 @@ async def bootstrap_default_source_root() -> None: async def start_initial_scan(): - """Start the initial library scan""" + """Start the initial library scan. + + NOTE: the folder watcher (watch_folders task) is intentionally NOT + dispatched here. It's an infinite loop celery task and every backend + restart was queuing a new instance, eventually pinning every worker + and starving scan_folder dispatches. Re-enabling it needs a Redis + lock or a dedicated long-running container — until then the user + triggers scans manually via "Scan all folders". + """ try: - # Queue scan of all source roots scan_all_source_roots.delay() - - # Start folder watcher if configured - if settings.scanner.watch: - watch_folders.delay() - logger.info("Initial scan queued successfully") except Exception as e: logger.error(f"Failed to start initial scan: {e}")