-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
The peel function seems to have broken scope handling.
object MyApp extends ZIOAppDefault {
def run =
ZStream.unwrapScoped {
ZStream.scoped(ZIO.foreach(1 to 5)(resource)).flattenIterables.rechunk(10).peel(ZSink.head[Int]).map {
case (Some(head), tail) => (ZStream(head) ++ tail)
.mapZIO(i => ZIO.debug(s"processing $i").as(i))
.schedule(Schedule.spaced(1.second))
}
}.runDrain
def resource(i: Int) = ZIO.acquireRelease(ZIO.succeed(i))(i => ZIO.debug(s"closing $i"))
}
processing 1
processing 2
closing 5
closing 4
closing 3
closing 2
closing 1
processing 3
processing 4
processing 5
"dev.zio" %% "zio" % "2.0.15",
"dev.zio" %% "zio-streams" % "2.0.15"
Metadata
Metadata
Assignees
Labels
No labels