Skip to content

Commit 663e286

Browse files
authored
Merge pull request #2744 from nikiforo/par-eval-v3
parEvalMap* - fix test "cancels unneeded"
2 parents 1154536 + e6dbe2c commit 663e286

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

core/shared/src/test/scala/fs2/ParEvalMapSuite.scala

+6-4
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,15 @@ class ParEvalMapSuite extends Fs2Suite {
208208
}
209209

210210
def check(pipe: Pipe[IO, IO[Unit], Unit]) =
211-
IO.deferred[Unit]
212-
.flatMap { d =>
213-
val cancelled = IO.never.onCancel(d.complete(()).void)
214-
val stream = Stream(u, cancelled).covary[IO]
211+
(CountDownLatch[IO](2), IO.deferred[Unit])
212+
.mapN { case (latch, d) =>
213+
val w = latch.release *> latch.await
214+
val cancelled = IO.uncancelable(poll => w *> poll(IO.never).onCancel(d.complete(()).void))
215+
val stream = Stream(w *> u, cancelled).covary[IO]
215216
val action = stream.through(pipe).take(1).compile.drain
216217
action *> d.get
217218
}
219+
.flatten
218220
.assertEquals(())
219221
}
220222

0 commit comments

Comments
 (0)