You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Object IDs are the same (result of prints):
<core.dependency_injection.container.ServiceContainer object at 0x75671915cf50>
<core.dependency_injection.container.ServiceContainer object at 0x75671915cf50>
Result of self.pipe_registry.pipes() is [] empty. Pipes are not registered, parent container's state is lost in the child.
The text was updated successfully, but these errors were encountered:
I don't know what any of these objects are, so it's a little hard for me to understand the problem here. You mean that the singleton dependency isn't shared between the child and parent?
Yes, singletons are completely new, so the state of the parent's objects is lost. I think sharing state once (when creating a child) makes sense because you want to have access to shared registries from the parent (from the server bootstrapping stage) while using an isolated child container inside the request.
There's a cache for singletons, held in the container, my guess is that because the dep isn't in that cache in the child, it ends up delegating back to the parent. Clear bug, which I was semi-thinking about anyway.
In "Scoped Container" feature, the state of previously registered objects is not preserved in the child.
Boot time (Uvicorn server start time):
Request:
Object IDs are the same (result of prints):
<core.dependency_injection.container.ServiceContainer object at 0x75671915cf50>
<core.dependency_injection.container.ServiceContainer object at 0x75671915cf50>
Result of
self.pipe_registry.pipes()
is[]
empty. Pipes are not registered, parent container's state is lost in the child.The text was updated successfully, but these errors were encountered: