Skip to content

Instantly share code, notes, and snippets.

@natansil
Created May 22, 2021 16:44
Show Gist options
  • Save natansil/4030b5c3722aa0f68448278ea42c8f01 to your computer and use it in GitHub Desktop.
Save natansil/4030b5c3722aa0f68448278ea42c8f01 to your computer and use it in GitHub Desktop.
object FiberTracking {
type FiberTracking = Has[FiberTracking.Service]
trait Service {
def fibers: UIO[Chunk[Fiber.Runtime[Any, Any]]]
}
def fibers: URIO[FiberTracking, Chunk[Fiber.Runtime[Any, Any]]] =
ZIO.accessM(_.get.fibers)
def make(supervisor: Supervisor[Chunk[Fiber.Runtime[Any, Any]]]): FiberTracking =
Has(new Service {
override def fibers: UIO[Chunk[Fiber.Runtime[Any, Any]]] = supervisor.value
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment