Charan S commited on
Commit ·
57675a4
1
Parent(s): 93117c2
fix: HF Cold Start Backend
Browse filesFiles changed (2)
- database.py+9-1
- main.py+8
7 unmodified lines89101112131415167 unmodified linespassdef _make_engine():return create_async_engine(settings.database_url,pool_size=20,max_overflow=10,pool_pre_ping=True,7 unmodified lines891011121314151617181920212223247 unmodified linespassdef _normalize_db_url(url: str) -> str:if url.startswith("postgresql://"):return url.replace("postgresql://", "postgresql+asyncpg://", 1)if url.startswith("postgres://"):return url.replace("postgres://", "postgresql+asyncpg://", 1)return urldef _make_engine():return create_async_engine(_normalize_db_url(settings.database_url),pool_size=20,max_overflow=10,pool_pre_ping=True,
176 unmodified lines177178179180181182176 unmodified lines@asynccontextmanagerasync def lifespan(app: FastAPI):# Load active tenant config first — all voice/agent code depends on itawait load_active_config()176 unmodified lines177178179180181182183184185186187188189190176 unmodified lines@asynccontextmanagerasync def lifespan(app: FastAPI):# Seed DB on startup — idempotent upserts, safe to call every time.# Ensures agents + tenant config exist on a fresh Supabase instance.try:from seed import run_seedawait run_seed()except Exception as _seed_err:logger.warning("Startup seed failed (non-fatal): %s", _seed_err)# Load active tenant config first — all voice/agent code depends on itawait load_active_config()
database.py+9-1
main.py+8