feat: Run database migrations in a thread pool to avoid blocking during initialization
This commit is contained in:
@@ -28,8 +28,8 @@ async def lifespan(_app: FastAPI) -> AsyncGenerator[None]:
|
||||
logger = get_logger(__name__)
|
||||
logger.info("Starting application")
|
||||
|
||||
await init_db()
|
||||
logger.info("Database initialized")
|
||||
# await init_db()
|
||||
# logger.info("Database initialized")
|
||||
|
||||
# Start the extraction processor
|
||||
await extraction_processor.start()
|
||||
@@ -43,7 +43,8 @@ async def lifespan(_app: FastAPI) -> AsyncGenerator[None]:
|
||||
try:
|
||||
player_service = get_player_service() # Get the initialized player service
|
||||
app_services.scheduler_service = SchedulerService(
|
||||
get_session_factory(), player_service,
|
||||
get_session_factory(),
|
||||
player_service,
|
||||
)
|
||||
await app_services.scheduler_service.start()
|
||||
logger.info("Enhanced scheduler service started")
|
||||
|
||||
Reference in New Issue
Block a user