forked from cartsnitch/api
fix: remove dead dispose_engine import from API main.py
The top-level import of dispose_engine from cartsnitch_api.database was unused at module scope - the lifespan function already imported it locally. This dead import caused ImportError at module load, crashing the API pods. Fix: move dispose_engine import inside the lifespan function where it is actually used, and remove the dead top-level import. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -6,7 +6,6 @@ from fastapi import APIRouter, FastAPI
|
||||
|
||||
from cartsnitch_api.auth.routes import router as auth_router
|
||||
from cartsnitch_api.cache import cache_client
|
||||
from cartsnitch_api.database import dispose_engine
|
||||
from cartsnitch_api.middleware.cors import add_cors_middleware
|
||||
from cartsnitch_api.middleware.error_handler import add_error_handlers, add_error_monitor_middleware
|
||||
from cartsnitch_api.middleware.rate_limit import add_rate_limit_middleware
|
||||
@@ -26,6 +25,7 @@ from cartsnitch_api.routes.user import router as user_router
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
from cartsnitch_api.database import dispose_engine
|
||||
await cache_client.initialize()
|
||||
yield
|
||||
await cache_client.close()
|
||||
|
||||
Reference in New Issue
Block a user