Skip to content

Commit 7efddf8

Browse files
authored
docs: pass manage_lifespan=False to every app that shares a container (#80)
1 parent 060cc65 commit 7efddf8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ async def main() -> None:
8585
await app.run()
8686
```
8787

88-
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.
88+
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/).
8989

9090
## API
9191

0 commit comments

Comments
 (0)