fixed server support for request pipelining
All checks were successful
CI / build (push) Successful in 15m33s
All checks were successful
CI / build (push) Successful in 15m33s
This commit is contained in:
@@ -38,11 +38,12 @@ data class Configuration(
|
||||
val readIdleTimeout: Duration,
|
||||
val writeIdleTimeout: Duration,
|
||||
val idleTimeout: Duration,
|
||||
val requestPipelining : Boolean,
|
||||
)
|
||||
|
||||
data class Profile(
|
||||
val serverURI: URI,
|
||||
val connection: Connection?,
|
||||
val connection: Connection,
|
||||
val authentication: Authentication?,
|
||||
val connectionTimeout: Duration?,
|
||||
val maxConnections: Int,
|
||||
|
@@ -318,6 +318,9 @@ class RemoteBuildCacheClient(private val profile: Configuration.Profile) : AutoC
|
||||
) {
|
||||
pipeline.remove(this)
|
||||
responseFuture.complete(response)
|
||||
if(!profile.connection.requestPipelining) {
|
||||
pool.release(channel)
|
||||
}
|
||||
}
|
||||
|
||||
override fun exceptionCaught(ctx: ChannelHandlerContext, cause: Throwable) {
|
||||
@@ -332,6 +335,9 @@ class RemoteBuildCacheClient(private val profile: Configuration.Profile) : AutoC
|
||||
|
||||
override fun channelInactive(ctx: ChannelHandlerContext) {
|
||||
responseFuture.completeExceptionally(IOException("The remote server closed the connection"))
|
||||
if(!profile.connection.requestPipelining) {
|
||||
pool.release(channel)
|
||||
}
|
||||
super.channelInactive(ctx)
|
||||
}
|
||||
|
||||
@@ -352,6 +358,9 @@ class RemoteBuildCacheClient(private val profile: Configuration.Profile) : AutoC
|
||||
if (this === pipeline.last()) {
|
||||
ctx.close()
|
||||
}
|
||||
if(!profile.connection.requestPipelining) {
|
||||
pool.release(channel)
|
||||
}
|
||||
} else {
|
||||
super.userEventTriggered(ctx, evt)
|
||||
}
|
||||
@@ -401,8 +410,9 @@ class RemoteBuildCacheClient(private val profile: Configuration.Profile) : AutoC
|
||||
val ex = it.cause()
|
||||
log.warn(ex.message, ex)
|
||||
}
|
||||
|
||||
pool.release(channel)
|
||||
if(profile.connection.requestPipelining) {
|
||||
pool.release(channel)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
responseFuture.completeExceptionally(channelFuture.cause())
|
||||
|
@@ -30,7 +30,12 @@ object Parser {
|
||||
?: throw ConfigurationException("base-url attribute is required")
|
||||
var authentication: Configuration.Authentication? = null
|
||||
var retryPolicy: Configuration.RetryPolicy? = null
|
||||
var connection : Configuration.Connection? = null
|
||||
var connection : Configuration.Connection = Configuration.Connection(
|
||||
Duration.ofSeconds(60),
|
||||
Duration.ofSeconds(60),
|
||||
Duration.ofSeconds(30),
|
||||
false
|
||||
)
|
||||
var trustStore : Configuration.TrustStore? = null
|
||||
for (gchild in child.asIterable()) {
|
||||
when (gchild.localName) {
|
||||
@@ -97,10 +102,13 @@ object Parser {
|
||||
?.let(Duration::parse) ?: Duration.of(60, ChronoUnit.SECONDS)
|
||||
val writeIdleTimeout = gchild.renderAttribute("write-idle-timeout")
|
||||
?.let(Duration::parse) ?: Duration.of(60, ChronoUnit.SECONDS)
|
||||
val requestPipelining = gchild.renderAttribute("request-pipelining")
|
||||
?.let(String::toBoolean) ?: false
|
||||
connection = Configuration.Connection(
|
||||
readIdleTimeout,
|
||||
writeIdleTimeout,
|
||||
idleTimeout,
|
||||
requestPipelining
|
||||
)
|
||||
}
|
||||
|
||||
|
@@ -123,6 +123,13 @@
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="request-pipelining" type="xs:boolean" use="optional" default="false">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
Enables HTTP/1.1 request pipelining
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="noAuthType">
|
||||
|
Reference in New Issue
Block a user