stop PoolInterfaceActor on shutdown, #20842 (#20844)

This commit is contained in:
Patrik Nordwall 2016-06-28 13:47:23 +02:00 committed by Konrad Malawski
parent 72f8544efd
commit f791cf123b
3 changed files with 7 additions and 7 deletions

View file

@ -124,7 +124,7 @@ private class PoolInterfaceActor(gateway: PoolGateway)(implicit fm: Materializer
case Shutdown // signal coming in from gateway
log.debug("Shutting down host connection pool to {}:{}", hcps.host, hcps.port)
onComplete()
onCompleteThenStop()
while (!inputBuffer.isEmpty) {
val PoolRequest(request, responsePromise) = inputBuffer.dequeue()
responsePromise.completeWith(gateway(request))

View file

@ -60,8 +60,8 @@ class EntityDiscardingSpec extends AkkaSpec {
val (_, host, port) = TestUtils.temporaryServerHostnameAndPort()
val bound = Http().bindAndHandleSync(
req
HttpResponse(entity = HttpEntity(
ContentTypes.`text/csv(UTF-8)`, Source.fromIterator[ByteString](() testData.iterator))),
HttpResponse(entity = HttpEntity(
ContentTypes.`text/csv(UTF-8)`, Source.fromIterator[ByteString](() testData.iterator))),
host, port).futureValue
try {

View file

@ -4,13 +4,13 @@
package akka.http.scaladsl.model
import com.typesafe.config.{Config, ConfigFactory}
import com.typesafe.config.{ Config, ConfigFactory }
import scala.concurrent.Await
import scala.concurrent.duration._
import org.scalatest.{BeforeAndAfterAll, Inside, Matchers, WordSpec}
import org.scalatest.{ BeforeAndAfterAll, Inside, Matchers, WordSpec }
import akka.stream.ActorMaterializer
import akka.stream.scaladsl.{Sink, Source}
import akka.stream.scaladsl.{ Sink, Source }
import akka.util.ByteString
import akka.actor.ActorSystem
import headers._
@ -43,7 +43,7 @@ class MultipartSpec extends WordSpec with Matchers with Inside with BeforeAndAft
val result = streamed.toEntity(boundary = "boundary")
result.contentType shouldBe MediaTypes.`multipart/mixed`.withBoundary("boundary").withCharset(HttpCharsets.`UTF-8`)
val encoding = Await.result(result.dataBytes.runWith(Sink.seq), 1.second)
encoding .map(_.utf8String).mkString shouldBe "--boundary\r\nContent-Type: text/plain; charset=UTF-8\r\nETag: \"xzy\"\r\n\r\ndata\r\n--boundary--"
encoding.map(_.utf8String).mkString shouldBe "--boundary\r\nContent-Type: text/plain; charset=UTF-8\r\nETag: \"xzy\"\r\n\r\ndata\r\n--boundary--"
}
}