Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Scope propagation in ZStream#runScoped #9327

Merged
merged 1 commit into from
Nov 23, 2024

Conversation

kyri-petrou
Copy link
Contributor

@kyri-petrou kyri-petrou commented Nov 22, 2024

/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 of FiberRefs) as we have to maintain the full "history" of changes made to a FiberRef. The fix to the issue is rather simple; we always update the value of the FiberRef within FiberRef#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 in FiberRef#locally. I will followup with another PR that will refactor the way that we determine whether to apply shortcuts in FiberRefs

@kyri-petrou kyri-petrou changed the title Fix scoped stream propagation Fix Scope propagation in ZStream#runScoped Nov 22, 2024
@jdegoes jdegoes merged commit 63aa2b0 into zio:series/2.x Nov 23, 2024
18 checks passed
@kyri-petrou kyri-petrou deleted the fix-scoped-stream-propagation-2 branch November 24, 2024 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Strange behavior of the stream scope
2 participants