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

Implement Parallel Finalizers Mask #8204

Merged
merged 2 commits into from Jul 28, 2023
Merged

Conversation

adamgfraser
Copy link
Contributor

Currently in parallel operations such as zipWithPar if the workflows run in parallel each add finalizers those finalizers will be run sequentially in the reverse order of being added unless parallelFinalizers is explicitly used to indicate that finalizers should be run in parallel. This can introduce an unnecessary dependency between finalizers.

This PR improves this by implementing a parallelFinalizersMask operator which indicates that finalizers should be run in parallel but also provides a restore function that can be used to restore the original execution strategy for finalizers. It then uses this in ZIO#zipWithPar and ZIO.collectAllPar, as well as making similar changes in ZLayer#++.

@adamgfraser adamgfraser requested a review from jdegoes June 15, 2023 04:14
@jdegoes jdegoes merged commit e2e6fa8 into zio:series/2.x Jul 28, 2023
22 checks passed
@adamgfraser adamgfraser deleted the finalizers branch August 16, 2023 15:11
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.

None yet

2 participants