feat: lifetime check for mis_handler existence

This commit is contained in:
Chris Milne 2026-05-13 12:41:26 +01:00
parent e475a4a2c1
commit d81f865ec2

View file

@ -18,6 +18,7 @@ from src.auth.config import auth_settings
from src.misp.service import MISPHandler
# TODO: Create Pydantic request/response schemas
# TODO: Untie MISP connection from app loading
@asynccontextmanager
@ -25,7 +26,8 @@ async def lifespan(_application: FastAPI) -> AsyncGenerator:
# Startup
yield
# Shutdown
_application.misp_handler.stop_timer()
if hasattr(_application, "misp_handler"):
_application.misp_handler.stop_timer()
if settings.ENVIRONMENT.is_deployed: