Skip to content

Commit 46a2cd9

Browse files
committed
Use Future.zip instead of Future.flatMap(for-loop)
1 parent 3d0c37b commit 46a2cd9

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

streaming/src/main/scala/org/apache/spark/streaming/receiver/ReceivedBlockHandler.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,7 @@ private[streaming] class WriteAheadLogBasedBlockHandler(
169169
}
170170

171171
// Combine the futures, wait for both to complete, and return the write ahead log segment
172-
val combinedFuture = for {
173-
_ <- storeInBlockManagerFuture
174-
fileSegment <- storeInWriteAheadLogFuture
175-
} yield fileSegment
172+
val combinedFuture = storeInBlockManagerFuture.zip(storeInWriteAheadLogFuture).map(_._2)
176173
val segment = Await.result(combinedFuture, blockStoreTimeout)
177174
WriteAheadLogBasedStoreResult(blockId, segment)
178175
}

0 commit comments

Comments
 (0)