-str - #18806 - Replacing flatten(FlattenStrategy) with flattenConcat
This commit is contained in:
parent
06ce968b16
commit
ce10456804
15 changed files with 31 additions and 84 deletions
|
|
@ -61,7 +61,7 @@ private[http] object OutgoingConnectionBlueprint {
|
|||
val requestRendering: Flow[HttpRequest, ByteString, Unit] = Flow[HttpRequest]
|
||||
.map(RequestRenderingContext(_, hostHeader))
|
||||
.via(Flow[RequestRenderingContext].map(requestRendererFactory.renderToSource).named("renderer"))
|
||||
.flatten(FlattenStrategy.concat)
|
||||
.flattenConcat()
|
||||
|
||||
val methodBypass = Flow[HttpRequest].map(_.method)
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ private[http] object HttpServerBluePrint {
|
|||
Flow[ResponseRenderingContext]
|
||||
.via(Flow[ResponseRenderingContext].transform(() ⇒ new ErrorsTo500ResponseRecovery(log)).named("recover")) // FIXME: simplify after #16394 is closed
|
||||
.via(Flow[ResponseRenderingContext].transform(() ⇒ responseRendererFactory.newRenderer).named("renderer"))
|
||||
.flatten(FlattenStrategy.concat)
|
||||
.flattenConcat()
|
||||
.via(Flow[ResponseRenderingOutput].transform(() ⇒ errorLogger(log, "Outgoing response stream error")).named("errorLogger"))
|
||||
|
||||
BidiFlow.fromGraph(FlowGraph.create(requestParsingFlow, rendererPipeline, oneHundredContinueSource)((_, _, _) ⇒ ()) { implicit b ⇒
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
package akka.http.impl.engine.ws
|
||||
|
||||
import akka.util.ByteString
|
||||
import akka.stream.scaladsl.{ FlattenStrategy, Source, Flow }
|
||||
import akka.stream.scaladsl.{ Source, Flow }
|
||||
|
||||
import Protocol.Opcode
|
||||
import akka.http.scaladsl.model.ws._
|
||||
|
|
@ -32,6 +32,6 @@ private[http] object MessageToFrameRenderer {
|
|||
case bm: BinaryMessage ⇒ streamedFrames(Opcode.Binary, bm.dataStream)
|
||||
case TextMessage.Strict(text) ⇒ strictFrames(Opcode.Text, ByteString(text, "UTF-8"))
|
||||
case tm: TextMessage ⇒ streamedFrames(Opcode.Text, tm.textStream.transform(() ⇒ new Utf8Encoder))
|
||||
}.flatten(FlattenStrategy.concat)
|
||||
}.flattenConcat()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import language.higherKinds
|
|||
import java.nio.charset.Charset
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
import com.typesafe.config.Config
|
||||
import akka.stream.scaladsl.{ FlattenStrategy, Flow, Source }
|
||||
import akka.stream.scaladsl.{ Flow, Source }
|
||||
import akka.stream.stage._
|
||||
import scala.concurrent.duration.Duration
|
||||
import scala.concurrent.{ Await, Future }
|
||||
|
|
@ -54,7 +54,7 @@ package object util {
|
|||
.filter(_._1.nonEmpty)
|
||||
.map { case (prefix, tail) ⇒ (prefix.head, tail) }
|
||||
}
|
||||
.flatten(FlattenStrategy.concat)
|
||||
.flattenConcat()
|
||||
|
||||
private[http] def printEvent[T](marker: String): Flow[T, T, Unit] =
|
||||
Flow[T].transform(() ⇒ new PushPullStage[T, T] {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import scala.collection.immutable
|
|||
import scala.util.{ Failure, Success, Try }
|
||||
import akka.stream.Materializer
|
||||
import akka.stream.io.SynchronousFileSource
|
||||
import akka.stream.scaladsl.{ FlattenStrategy, Source }
|
||||
import akka.stream.scaladsl.{ Source }
|
||||
import akka.http.scaladsl.util.FastFuture
|
||||
import akka.http.scaladsl.model.headers._
|
||||
import akka.http.impl.engine.rendering.BodyPartRenderer
|
||||
|
|
@ -40,7 +40,7 @@ sealed trait Multipart {
|
|||
val chunks =
|
||||
parts
|
||||
.transform(() ⇒ BodyPartRenderer.streamed(boundary, charset.nioCharset, partHeadersSizeHint = 128, log))
|
||||
.flatten(FlattenStrategy.concat)
|
||||
.flattenConcat()
|
||||
HttpEntity.Chunked(mediaType withBoundary boundary, chunks)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import akka.http.scaladsl.model.headers._
|
|||
import akka.http.scaladsl.util.FastFuture
|
||||
import akka.http.scaladsl.util.FastFuture._
|
||||
import akka.stream.ActorMaterializer
|
||||
import akka.stream.scaladsl.{ FlattenStrategy, _ }
|
||||
import akka.stream.scaladsl._
|
||||
import akka.util.ByteString
|
||||
import com.typesafe.config.{ Config, ConfigFactory }
|
||||
import org.scalatest.matchers.Matcher
|
||||
|
|
@ -539,7 +539,7 @@ class RequestParserSpec extends FreeSpec with Matchers with BeforeAndAfterAll {
|
|||
}
|
||||
}
|
||||
}
|
||||
.flatten(FlattenStrategy.concat)
|
||||
.flattenConcat()
|
||||
.map(strictEqualify)
|
||||
.grouped(100000).runWith(Sink.head)
|
||||
.awaitResult(awaitAtMost)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue