diff --git a/CHANGELOG.md b/CHANGELOG.md index 07a7ea7..898c095 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ Proteus Changelog. ## Unreleased ### No issue +**Fix for looping requests when response wrapped in completable future.** + + +[f91ff64db7a64ea](https://github.com/noboomu/proteus/commit/f91ff64db7a64ea) Joshua Bauer *2020-09-14 19:41:59* + **Cleanup shutdown and expose worker in request.** diff --git a/proteus-core/src/main/java/io/sinistral/proteus/ProteusApplication.java b/proteus-core/src/main/java/io/sinistral/proteus/ProteusApplication.java index a3aaced..8ad6783 100644 --- a/proteus-core/src/main/java/io/sinistral/proteus/ProteusApplication.java +++ b/proteus-core/src/main/java/io/sinistral/proteus/ProteusApplication.java @@ -32,6 +32,7 @@ import org.apache.commons.lang3.time.DurationFormatUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.xnio.Options; import javax.ws.rs.core.MediaType; import java.io.ByteArrayOutputStream; @@ -314,12 +315,15 @@ public void buildServer() Undertow.Builder undertowBuilder = Undertow.builder().addHttpListener(httpPort, config.getString("application.host")) + .setBufferSize(Long.valueOf(config.getMemorySize("undertow.bufferSize").toBytes()).intValue()) .setIoThreads(Runtime.getRuntime().availableProcessors() * config.getInt("undertow.ioThreadsMultiplier")) .setWorkerThreads(Runtime.getRuntime().availableProcessors() * config.getInt("undertow.workerThreadMultiplier")) .setDirectBuffers(config.getBoolean("undertow.directBuffers")) .setSocketOption(org.xnio.Options.BACKLOG, config.getInt("undertow.socket.backlog")) .setSocketOption(org.xnio.Options.REUSE_ADDRESSES, config.getBoolean("undertow.socket.reuseAddresses")) + .setSocketOption(org.xnio.Options.READ_TIMEOUT, config.getInt("undertow.socket.readTimeout")) + .setSocketOption(org.xnio.Options.WRITE_TIMEOUT, config.getInt("undertow.socket.writeTimeout")) .setServerOption(UndertowOptions.ENABLE_HTTP2, config.getBoolean("undertow.server.enableHttp2")) .setServerOption(UndertowOptions.ALWAYS_SET_DATE, config.getBoolean("undertow.server.alwaysSetDate")) .setServerOption(UndertowOptions.ALWAYS_SET_KEEP_ALIVE, config.getBoolean("undertow.server.alwaysSetKeepAlive")) diff --git a/proteus-core/src/main/resources/reference.conf b/proteus-core/src/main/resources/reference.conf index a0c0f73..2d0f960 100644 --- a/proteus-core/src/main/resources/reference.conf +++ b/proteus-core/src/main/resources/reference.conf @@ -174,8 +174,8 @@ swagger { undertow { + # refer to https://undertow.io/javadoc/2.0.x/io/undertow/UndertowOptions.html for details server { - alwaysSetDate = true alwaysSetKeepAlive = false recordRequestStartTime = false @@ -185,9 +185,12 @@ undertow } + # refer to https://docs.jboss.org/xnio/3.0/api/org/xnio/Options.html for details socket { backlog = 10000 reuseAddresses = true + readTimeout = 90000 + writeTimeout = 90000 } diff --git a/proteus-core/src/test/resources/application.conf b/proteus-core/src/test/resources/application.conf index 3a58d9e..dcd836d 100644 --- a/proteus-core/src/test/resources/application.conf +++ b/proteus-core/src/test/resources/application.conf @@ -80,6 +80,8 @@ undertow socket { backlog = 10000 + readTimeout = 90000 + writeTimeout = 90000 }