Replaced PushStage based Take with GraphStage #19834

Changes suggested by @viktorklang

Added take to binary compatibility exclude

Cleanup
This commit is contained in:
Tapio Rautonen 2016-02-28 23:14:29 +02:00
parent 65a9e0a0f9
commit 1bcc1310d2
6 changed files with 50 additions and 30 deletions

View file

@ -16,8 +16,10 @@ class InterpreterStressSpec extends AkkaSpec with GraphInterpreterSpecKit {
val map = Map((x: Int) x + 1, stoppingDecider).toGS
// GraphStage can be reused
// GraphStages can be reused
val dropOne = Drop(1)
val takeOne = Take(1)
val takeHalfOfRepetition = Take(repetition / 2)
"Interpreter" must {
@ -45,7 +47,7 @@ class InterpreterStressSpec extends AkkaSpec with GraphInterpreterSpecKit {
"work with a massive chain of maps with early complete" in new OneBoundedSetup[Int](
Vector.fill(halfLength)(map) ++
Seq(Take(repetition / 2).toGS) ++
Seq(takeHalfOfRepetition) ++
Vector.fill(halfLength)(map): _*) {
lastEvents() should be(Set.empty)
@ -72,7 +74,7 @@ class InterpreterStressSpec extends AkkaSpec with GraphInterpreterSpecKit {
info(s"Chain finished in $time seconds ${(chainLength * repetition) / (time * 1000 * 1000)} million maps/s")
}
"work with a massive chain of takes" in new OneBoundedSetup[Int](Vector.fill(chainLength / 10)(Take(1))) {
"work with a massive chain of takes" in new OneBoundedSetup[Int](Vector.fill(chainLength / 10)(takeOne): _*) {
lastEvents() should be(Set.empty)
downstream.requestOne()