Created
May 22, 2021 16:58
-
-
Save natansil/2eafa1cf72967237f767734a98094850 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object RuntimeOps { | |
implicit class RuntimeEnvOps[R <: Has[_]](val runtime: zio.Runtime[R]) extends AnyVal { | |
def withFiberTracking(implicit tag: zio.Tag[R]): zio.Runtime[R with FiberTracking] = { | |
val supervisor = runtime.unsafeRunTask(Supervisor.track(weak = false)) | |
runtime | |
.mapPlatform(_.withSupervisor(supervisor)) | |
.map(_.union[FiberTracking](FiberTracking.make(supervisor))) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment