New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KTOR-4419 Ignore request timeout for WebSocket requests #3062
Conversation
ktor-client/ktor-client-tests/common/test/io/ktor/client/tests/WebSocketTest.kt
Outdated
Show resolved
Hide resolved
* The request timeout is handled by the plugin and disabled for the WebSockets. | ||
*/ | ||
val isWebSocket = request.url.protocol.isWebsocket() | ||
if (request.getCapabilityOrNull(HttpTimeout) != null || isWebSocket || request.isUpgradeRequest()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain why we do request.getCapabilityOrNull(HttpTimeout) != null
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CIO
engine had timeouts before we had the HttpTimeout
plugin. This place handles only the case when the plugin is not installed.
fun testRequestTimeoutIgnoredWithWebSocket(): Unit = runBlocking { | ||
val client = HttpClient(CIO) { | ||
engine { | ||
requestTimeout = 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make it shorted, to avoid running test for 20 seconds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's ms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, ok. sorry =)
install(WebSockets) | ||
|
||
install(HttpTimeout) { | ||
requestTimeoutMillis = 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here the same :)
Fix KTOR-4419