Skip to content

Commit

Permalink
Merge branch 'main' into topic/sbt-typelevel-site
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilquist authored Feb 19, 2022
2 parents b1afb62 + 45dab3c commit 1739e7f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.4.2"
version = "3.4.3"

style = default

Expand Down
2 changes: 1 addition & 1 deletion core/shared/src/main/scala/fs2/Stream.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2123,7 +2123,7 @@ final class Stream[+F[_], +O] private[fs2] (private[fs2] val underlying: Pull[F,
Deferred[F2, Unit].flatMap { pushed =>
val init = initFork(channel, pushed.complete(()).void)
poll(init).onCancel(releaseAndCheckCompletion).flatMap { send =>
val action = f(el).attempt.flatMap(send) *> pushed.get
val action = F.catchNonFatal(f(el)).flatten.attempt.flatMap(send) *> pushed.get
F.start(stop.get.race(action) *> releaseAndCheckCompletion)
}
}
Expand Down
22 changes: 22 additions & 0 deletions core/shared/src/test/scala/fs2/ParEvalMapSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,26 @@ class ParEvalMapSuite extends Fs2Suite {
(1 to iterations).toList.as(action).sequence_
}
}

group("issue-2825, Stream shouldn't hang after exceptions thrown in") {
test("parEvalMapUnordered") {
Stream
.eval(IO.unit)
.parEvalMapUnordered(Int.MaxValue)(_ => throw new RuntimeException)
.compile
.drain
.attempt
.timeout(2.seconds)
}

test("parEvalMap") {
Stream
.eval(IO.unit)
.parEvalMap(Int.MaxValue)(_ => throw new RuntimeException)
.compile
.drain
.attempt
.timeout(2.seconds)
}
}
}
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
val sbtTypelevelVersion = "0.4.5"
addSbtPlugin("org.typelevel" % "sbt-typelevel" % sbtTypelevelVersion)
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % sbtTypelevelVersion)
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.8.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.9.0")
addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.9.9")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.24")
Expand Down

0 comments on commit 1739e7f

Please sign in to comment.