Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cmyui committed Nov 11, 2023
1 parent af9f8a5 commit 0f6f411
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
11 changes: 6 additions & 5 deletions app/api/rest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import annotations

import logging

from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from shared_modules import logger
from starlette.middleware.base import BaseHTTPMiddleware

from app.api import middlewares
Expand All @@ -12,17 +13,17 @@
def init_http(api: FastAPI) -> None:
@api.on_event("startup")
async def startup_http() -> None:
logger.info("Starting up http connector")
logging.info("Starting up http connector")
service_http = http.ServiceHTTP()
api.state.http = service_http
logger.info("HTTP connector started up")
logging.info("HTTP connector started up")

@api.on_event("shutdown")
async def shutdown_http() -> None:
logger.info("Shutting down http connector")
logging.info("Shutting down http connector")
await api.state.http.aclose()
del api.state.http
logger.info("HTTP connector shut down")
logging.info("HTTP connector shut down")


def init_middlewares(api: FastAPI) -> None:
Expand Down
5 changes: 0 additions & 5 deletions app/api_boot.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
from __future__ import annotations

from shared_modules import logger

from app.api.rest import init_api
from app.common import settings

logger.configure_logging(app_env=settings.APP_ENV, log_level=settings.LOG_LEVEL)

api = init_api()

0 comments on commit 0f6f411

Please sign in to comment.