-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
How to define connection timeout? #173
Comments
Wrong approach. For some reason I thought that val httpClient = HttpClient {
// From default client
install(ContentNegotiation) {
json(Json { ignoreUnknownKeys = true })
}
install(HttpRequestRetry) {
maxRetries = 3
constantDelay(1000)
retryOnExceptionIf { _, error ->
println("Retrying...")
error is ConnectException
}
}
} The only problem is that I need to manually add |
Hi! Thanks for opening an issue, and don't worry about disturbing. I'm happy to have questions, it means I can improve the docs and/or fix stuff :) What exactly was timing out then? The initial I understand that this was not the best UX, especially since any additional config on the Ktor http client requires you to manually rewrite all the initial default config from this library. I'll try to make things better in this respect. Actually I could add retries by default, because it's probably desirable for most use cases. |
Reopening to track improvements/retry |
Nope, timeout is something else. And it doesn't help if
That's fine I think. I'm not sure how this could be improved tbh. I can only think about something like class ChromeDPClient(
private val remoteDebugUrl: String = "http://localhost:9222",
private val overrideHostHeader: Boolean = false,
private val webSocketClient: WebSocketClient = DEFAULT_WEBSOCKET_CLIENT,
private val httpClient: HttpClient = if (overrideHostHeader) DEFAULT_HTTP_CLIENT_WITH_HOST_OVERRIDE else DEFAULT_HTTP_CLIENT
) {
constructor(
remoteDebugUrl: String = "http://localhost:9222",
overrideHostHeader: Boolean = false,
webSocketClient: WebSocketClient = DEFAULT_WEBSOCKET_CLIENT,
httpClientConfig: HttpClient.() -> Unit
): this(remoteDebugUrl, overrideHostHeader, webSocketClient, if (overrideHostHeader) DEFAULT_HTTP_CLIENT_WITH_HOST_OVERRIDE else DEFAULT_HTTP_CLIENT) {
httpClient.httpClientConfig()
}
//...
} Or maybe DSL instead of constructor. But I don't think it's that important tbh 🤷 |
Yes this kind of lambda for extra config is what I had in mind. Also, would a function like |
Maybe. Retrying is configurable so you'll probably need something like |
I was thinking about hiding the retry completely as an implementation detail, and exposing only a simple function to wait (users can use |
Well, you can, but in some cases people might want to use |
True, it might be desirable to leave the option to the user to do more or less active polling. As long as there is a default. |
Closing this question, as further improvements will be tracked in #174 |
Hi. In my program I'm starting an external application and then I need to wait for webtools to initialize in this application. However, I cannot set DevTools
websocket
connection timeout for some reason. Well, I can, but it doesn't work. What I've tried:In theory it should set connection timeout to 20 seconds but it's still 5 seconds. Is this an issue or am I missing something?
The text was updated successfully, but these errors were encountered: