shut down download thread
This commit is contained in:
parent
57da1f1272
commit
1ca105f330
@ -101,6 +101,18 @@ async def lifespan(app: FastAPI):
|
||||
# Shutdown
|
||||
logger.info("FastAPI application shutting down")
|
||||
|
||||
# Shutdown download service and its thread pool
|
||||
try:
|
||||
from src.server.services.download_service import _download_service_instance
|
||||
if _download_service_instance is not None:
|
||||
logger.info("Stopping download service...")
|
||||
await _download_service_instance.stop()
|
||||
logger.info("Download service stopped successfully")
|
||||
except Exception as e:
|
||||
logger.error("Error stopping download service: %s", e, exc_info=True)
|
||||
|
||||
logger.info("FastAPI application shutdown complete")
|
||||
|
||||
|
||||
# Initialize FastAPI app with lifespan
|
||||
app = FastAPI(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user