Skip to content

Commit

Permalink
[SCB-2872]Fix idle timeout for read and write is not properly set pro…
Browse files Browse the repository at this point in the history
…blem (#4297)
  • Loading branch information
liubao68 authored Apr 15, 2024
1 parent 0479ea7 commit cb9c347
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ static HttpClientOptions createHttpClientOptions(HttpClientOptionsSPI spi) {
httpClientOptions.setProtocolVersion(spi.getHttpVersion());
httpClientOptions.setConnectTimeout(spi.getConnectTimeoutInMillis());
httpClientOptions.setIdleTimeout(spi.getIdleTimeoutInSeconds());
httpClientOptions.setReadIdleTimeout(spi.getIdleTimeoutInSeconds());
httpClientOptions.setWriteIdleTimeout(spi.getIdleTimeoutInSeconds());
httpClientOptions.setTryUseCompression(spi.isTryUseCompression());
httpClientOptions.setMaxWaitQueueSize(spi.getMaxWaitQueueSize());
httpClientOptions.setMaxPoolSize(spi.getMaxPoolSize());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,12 @@ public class RestServerVerticle extends AbstractVerticle {

private static final String SSL_KEY = "rest.provider";

private Endpoint endpoint;

private URIEndpointObject endpointObject;

@Override
public void init(Vertx vertx, Context context) {
super.init(vertx, context);
this.endpoint = (Endpoint) context.config().getValue(AbstractTransport.ENDPOINT_KEY);
Endpoint endpoint = (Endpoint) context.config().getValue(AbstractTransport.ENDPOINT_KEY);
this.endpointObject = (URIEndpointObject) endpoint.getAddress();
}

Expand Down Expand Up @@ -137,9 +135,8 @@ void mountGlobalRestFailureHandler(Router mainRouter) {
return;
}
HttpServerResponse response = ctx.response();
if (ctx.failure() instanceof InvocationException) {
if (ctx.failure() instanceof InvocationException exception) {
// ServiceComb defined exception
InvocationException exception = (InvocationException) ctx.failure();
response.setStatusCode(exception.getStatusCode());
response.setStatusMessage(exception.getReasonPhrase());
response.end(exception.getErrorData().toString());
Expand Down Expand Up @@ -270,8 +267,6 @@ private HttpServerOptions createDefaultHttpServerOptions() {
serverOptions.setUseAlpn(TransportConfig.getUseAlpn())
.setHttp2ConnectionWindowSize(TransportConfig.getHttp2ConnectionWindowSize())
.setIdleTimeout(TransportConfig.getHttp2ConnectionIdleTimeoutInSeconds())
.setReadIdleTimeout(TransportConfig.getHttp2ConnectionIdleTimeoutInSeconds())
.setWriteIdleTimeout(TransportConfig.getHttp2ConnectionIdleTimeoutInSeconds())
.setInitialSettings(new Http2Settings().setPushEnabled(TransportConfig.getPushEnabled())
.setMaxConcurrentStreams(TransportConfig.getMaxConcurrentStreams())
.setHeaderTableSize(TransportConfig.getHttp2HeaderTableSize())
Expand All @@ -281,8 +276,6 @@ private HttpServerOptions createDefaultHttpServerOptions() {
);
} else {
serverOptions.setIdleTimeout(TransportConfig.getConnectionIdleTimeoutInSeconds());
serverOptions.setReadIdleTimeout(TransportConfig.getConnectionIdleTimeoutInSeconds());
serverOptions.setWriteIdleTimeout(TransportConfig.getConnectionIdleTimeoutInSeconds());
}
if (endpointObject.isSslEnabled()) {
SSLOptionFactory factory =
Expand Down

0 comments on commit cb9c347

Please sign in to comment.