diff --git a/akka-stream-tests/src/test/scala/akka/stream/scaladsl/HubSpec.scala b/akka-stream-tests/src/test/scala/akka/stream/scaladsl/HubSpec.scala index b42b3cb441..0c9606e54a 100644 --- a/akka-stream-tests/src/test/scala/akka/stream/scaladsl/HubSpec.scala +++ b/akka-stream-tests/src/test/scala/akka/stream/scaladsl/HubSpec.scala @@ -698,8 +698,15 @@ class HubSpec extends StreamSpec { (0 until 16).foreach(upstream.sendNext(_)) - downstream1.expectNext(0, 2, 4, 6) + downstream1.expectNext(0, 2, 4, 6) // 8, 10, 12, 14 stays in buffer bc no demand + // if we don't demand more from downstream 1 here, there is a race condition where + // demand from downstream 2 is lost, because the buffer was full with elements for the other partition + // however this is likely because of the very fine grained demand logic in this test and not likely + // to happen in reality where both downstreams are likely going to keep pulling, or canceling + // for a scenario where one dosntream continous back pressures, head of line blocking can anyway happen + downstream1.request(1) downstream2.expectNext(1, 3, 5, 7, 9, 11, 13, 15) + downstream1.expectNext(8) downstream1.expectNoMessage(100.millis) downstream2.expectNoMessage(100.millis)