-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Remove Blocking From The Environment #5080
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
Conversation
// Reference user's lambda for the tracer | ||
ZIOFn.recordTrace(() => effect) { | ||
ZIO.effectSuspendTotal { | ||
import java.util.concurrent.atomic.AtomicReference |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this fine in shared
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
object Blocking { | ||
|
||
val blockingExecutor: Executor = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lazy val perhaps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work! Going to clean things up for a lot of use cases.
Resolves #5076.
Removes the
Blocking
service from the environment. Blocking is now managed by a collection of operators that lock the effect to anExecutor
backed by a blocking thread pool. Right now this is just a global blocking thread pool but we could potentially allow each fiber to have a blocking executor as well as a normal executor associated with it. Then we could provide a variant ofshift
that allowed setting that blocking executor to a new value. This would allow setting the blocking executor to a new value within a scope.