ContextDependency#
- class mobu.dependencies.context.ContextDependency#
Bases:
object
Provide a per-request context as a FastAPI dependency.
Each request gets a
RequestContext
. To save overhead, the portions of the context that are shared by all requests are collected into the single process-globalProcessContext
and reused with each request.Attributes Summary
Methods Summary
__call__
(request, logger)Create a per-request context.
aclose
()Clean up the per-process configuration.
initialize
(event_manager)Initialize the process-wide shared context.
Attributes Documentation
- process_context#
Methods Documentation
- async __call__(request, logger)#
Create a per-request context.
- Parameters:
request (
Request
)logger (
BoundLogger
)
- Return type:
- async initialize(event_manager)#
Initialize the process-wide shared context.
- Parameters:
event_manager (
EventManager
)- Return type: