From 40f88cd9c6da52b70ea96c44d3697831f98151a6 Mon Sep 17 00:00:00 2001 From: He-Pin Date: Fri, 10 Jan 2025 19:10:58 +0800 Subject: [PATCH] chore: Require parallelism >= 1 in MapAsync and MapAsyncUnordered --- .../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")