It seems like there is a similar issue (as in #62) with the teardown order, but this time for context resources.
from that_depends import BaseContainer, providers, container_context
async def resource(name, **kwargs):
yield name
print("tearing down", name)
class Container(BaseContainer):
a = providers.AsyncContextResource(resource, "A")
b = providers.AsyncContextResource(resource, "B", a=a)
async with container_context():
await Container.a()
await Container.b()
# Output:
# tearing down A
# tearing down B
Resource B depends on A, but A is torn down first. As far as I can tell, this can also cause runtime errors if during the teardown of resource B it's crucial resource A in the correct state.
Hello!
It seems like there is a similar issue (as in #62) with the teardown order, but this time for context resources.
Resource
B
depends onA
, butA
is torn down first. As far as I can tell, this can also cause runtime errors if during the teardown of resourceB
it's crucial resourceA
in the correct state.