Skip to content

Commit

Permalink
Check if requests are not empty prior to running them
Browse files Browse the repository at this point in the history
  • Loading branch information
kyri-petrou committed Mar 29, 2024
1 parent a294bcd commit 3bcc616
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion zio-query/shared/src/main/scala/zio/query/DataSource.scala
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ object DataSource {
def run(requests: Chunk[A])(implicit trace: Trace): ZIO[R, Nothing, CompletedRequestMap]
final def runAll(requests: Chunk[Chunk[A]])(implicit trace: Trace): ZIO[R, Nothing, CompletedRequestMap] =
ZIO.foldLeft(requests)(CompletedRequestMap.empty) { case (completedRequestMap, requests) =>
if (completedRequestMap.isEmpty) run(requests)
if (completedRequestMap.isEmpty && requests.nonEmpty) run(requests)
else {
val newRequests = requests.filterNot(completedRequestMap.contains)
if (newRequests.isEmpty) ZIO.succeed(completedRequestMap)
Expand Down

0 comments on commit 3bcc616

Please sign in to comment.