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
During the post mortem for Issue #2870, we invented an idea to help prevent it in the future. That bug was due to confusion caused by the fact that we allocated a registry and also a narrower-manager (a ChainDBReader/Follower) that in turn used that registry, but did not register itself in that registry, despite the registry and the manager having the same lifetime. We incorrectly assumed that newReader registered itself in the registry that it was passed.
So we're going to introduce a ResourceRegistry combinator for use in this situation, where a bracket-ed thing and a registry it needs share the same lifetime. This will let us be very explicit about that coincident lifetime, which should make it very obvious if future changes cause the lifetimes to become different.
The text was updated successfully, but these errors were encountered:
The only lingering thought is that the interface we chose for the combinator uses ResourceRegistry m -> m a instead of m (ResourceRegistry m -> a). The former is usually the first we think of and is more flexible, but the latter restricts the usage in a subtle way that seems more precise for our intended use of the combinator. The key idea is that the former lets the allocator of a allocate other resources in the registry. That's not necessarily problematic, but in the context of this function, it shouldn't be necessary to put any such resources in the registry: they can be handled in the bracketing logic.
During the post mortem for Issue #2870, we invented an idea to help prevent it in the future. That bug was due to confusion caused by the fact that we allocated a
registry
and also a narrower-manager (aChainDB
Reader
/Follower
) that in turn used that registry, but did not register itself in that registry, despite the registry and the manager having the same lifetime. We incorrectly assumed thatnewReader
registered itself in the registry that it was passed.So we're going to introduce a
ResourceRegistry
combinator for use in this situation, where abracket
-ed thing and a registry it needs share the same lifetime. This will let us be very explicit about that coincident lifetime, which should make it very obvious if future changes cause the lifetimes to become different.The text was updated successfully, but these errors were encountered: