Fix download service init when anime dir not configured
This commit is contained in:
@@ -113,11 +113,21 @@ async def lifespan(app: FastAPI):
|
||||
progress_service.subscribe("progress_updated", progress_event_handler)
|
||||
|
||||
# Initialize download service and restore queue from database
|
||||
# Only if anime directory is configured
|
||||
try:
|
||||
from src.server.config.settings import settings
|
||||
|
||||
from src.server.utils.dependencies import get_download_service
|
||||
download_service = get_download_service()
|
||||
await download_service.initialize()
|
||||
logger.info("Download service initialized and queue restored")
|
||||
|
||||
if settings.anime_directory:
|
||||
download_service = get_download_service()
|
||||
await download_service.initialize()
|
||||
logger.info("Download service initialized and queue restored")
|
||||
else:
|
||||
logger.info(
|
||||
"Download service initialization skipped - "
|
||||
"anime directory not configured"
|
||||
)
|
||||
except Exception as e:
|
||||
logger.warning("Failed to initialize download service: %s", e)
|
||||
# Continue startup - download service can be initialized later
|
||||
|
||||
Reference in New Issue
Block a user