Fix Scope propagation in ZStream#runScoped
#9327
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
/fixes #9316
In some complex usage patterns such as the one in the linked issue, we cannot simply revert the state of fiber refs within
FiberRef#locally
(so that we can reuse the same instance ofFiberRefs
) as we have to maintain the full "history" of changes made to aFiberRef
. The fix to the issue is rather simple; we always update the value of theFiberRef
withinFiberRef#locally
when reverting the value.The annoying part is that this fix "destroys" some of the optimizations that we had in place as it requires a new instance of
FiberRefs
to be created whenever we revert the state inFiberRef#locally
. I will followup with another PR that will refactor the way that we determine whether to apply shortcuts inFiberRefs