Skip to content

Commit

Permalink
Ensure consumer context dependency is initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathansick committed Aug 14, 2024
1 parent fc62065 commit 4ae7a37
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ook/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from safir.middleware.x_forwarded import XForwardedMiddleware
from structlog import get_logger

from ook.dependencies.consumercontext import consumer_context_dependency
from ook.dependencies.context import context_dependency

from .config import config
Expand All @@ -45,6 +46,7 @@ async def lifespan(app: FastAPI) -> AsyncIterator:
)

await context_dependency.initialize()
await consumer_context_dependency.initialize()

async with kafka_router.lifespan_context(app):
logger.info("Ook start up complete.")
Expand All @@ -54,6 +56,7 @@ async def lifespan(app: FastAPI) -> AsyncIterator:
logger.info("Ook is shutting down.")

await context_dependency.aclose()
await consumer_context_dependency.aclose()

logger.info("Ook shut down up complete.")

Expand Down

0 comments on commit 4ae7a37

Please sign in to comment.