+htc a safer Future.awaitResult that doesn't throw away the call stack of the awaiter
This commit is contained in:
parent
6e98623679
commit
3f0731b788
2 changed files with 17 additions and 3 deletions
|
|
@ -7,7 +7,8 @@ package akka.http.testkit
|
|||
import java.util.concurrent.CountDownLatch
|
||||
import scala.collection.immutable
|
||||
import scala.concurrent.duration._
|
||||
import scala.concurrent.{ Await, ExecutionContext }
|
||||
import scala.concurrent.ExecutionContext
|
||||
import akka.http.util._
|
||||
import akka.stream.FlowMaterializer
|
||||
import akka.stream.scaladsl._
|
||||
import akka.http.model.HttpEntity.ChunkStreamPart
|
||||
|
|
@ -95,6 +96,6 @@ trait RouteTestResultComponent {
|
|||
failTest("Request was neither completed nor rejected within " + timeout)
|
||||
|
||||
private def awaitAllElements[T](data: Source[T]): immutable.Seq[T] =
|
||||
Await.result(data.grouped(Int.MaxValue).runWith(Sink.head), timeout)
|
||||
data.collectAll.awaitResult(timeout)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue