From b160861c4186f73ef44de30f1f3b5a33c2c55562 Mon Sep 17 00:00:00 2001 From: "He-Pin(kerr)" Date: Fri, 10 Jan 2025 21:18:39 +0800 Subject: [PATCH] chore: Require parallelism >= 1 in MapAsync and MapAsyncUnordered (#1700) --- .../main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala index 1b23fc96c9..737116fd22 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/Ops.scala @@ -1281,6 +1281,7 @@ private[stream] object Collect { */ @InternalApi private[pekko] final case class MapAsync[In, Out](parallelism: Int, f: In => Future[Out]) extends GraphStage[FlowShape[In, Out]] { + require(parallelism >= 1, "parallelism must be at least 1") import MapAsync._ @@ -1388,6 +1389,7 @@ private[stream] object Collect { */ @InternalApi private[pekko] final case class MapAsyncUnordered[In, Out](parallelism: Int, f: In => Future[Out]) extends GraphStage[FlowShape[In, Out]] { + require(parallelism >= 1, "parallelism must be at least 1") private val in = Inlet[In]("MapAsyncUnordered.in") private val out = Outlet[Out]("MapAsyncUnordered.out")