feat: lifetime check for mis_handler existence
This commit is contained in:
parent
e475a4a2c1
commit
d81f865ec2
1 changed files with 3 additions and 1 deletions
|
|
@ -18,6 +18,7 @@ from src.auth.config import auth_settings
|
||||||
from src.misp.service import MISPHandler
|
from src.misp.service import MISPHandler
|
||||||
|
|
||||||
# TODO: Create Pydantic request/response schemas
|
# TODO: Create Pydantic request/response schemas
|
||||||
|
# TODO: Untie MISP connection from app loading
|
||||||
|
|
||||||
|
|
||||||
@asynccontextmanager
|
@asynccontextmanager
|
||||||
|
|
@ -25,7 +26,8 @@ async def lifespan(_application: FastAPI) -> AsyncGenerator:
|
||||||
# Startup
|
# Startup
|
||||||
yield
|
yield
|
||||||
# Shutdown
|
# Shutdown
|
||||||
_application.misp_handler.stop_timer()
|
if hasattr(_application, "misp_handler"):
|
||||||
|
_application.misp_handler.stop_timer()
|
||||||
|
|
||||||
|
|
||||||
if settings.ENVIRONMENT.is_deployed:
|
if settings.ENVIRONMENT.is_deployed:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue