From 47240e0f35c9729ee2230aebd734004a52a360d9 Mon Sep 17 00:00:00 2001 From: Artur Shiriev Date: Sat, 17 Oct 2026 16:17:08 +0300 Subject: [PATCH] docs: pass manage_lifespan=False to every app that shares a container --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dbe4c52..10d6cf5 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ async def main() -> None: await app.run() ``` -When several apps share one container, exactly one of them should own its lifespan, or the first app to stop closes the container for the rest. +When several apps share one container, pass `manage_lifespan=False` to every one of them and open and close the container yourself, as above. APP-scoped finalizers then run once, when your `async with` block exits. An app left at the default closes the container when it stops, while the other apps may still be handling work. See [FastAPI and FastStream sharing a container](https://modern-di.modern-python.org/recipes/shared-container/). ## API