Why are you using not bounded thread pool by default?
https://github.com/square/okhttp/blob/878bde8fd6939b508adeb21e2911e390cfe27326/okhttp/src/main/java/okhttp3/Dispatcher.java#L65
There are separate tunable limits per client, but also ways to reuse clients that could cause additional connections and threads to be required. So I think any sensible limit applied here would cause issues. However the limits in place should stop a client instance used sensible from creating an unbounded number of threads in practice.
Exactly. We put controls on how many runnables are executing concurrently.
https://github.com/square/okhttp/blob/878bde8fd6939b508adeb21e2911e390cfe27326/okhttp/src/main/java/okhttp3/Dispatcher.java#L47-L48
Looks like the request cound queued up unlimited and could cause OOM, is there a way to config dispatcher to have a bounded ready queue? Otherwise I have to bound it outside.
If it's a concern you should bound it outside. Otherwise we'd need a mechanism to configure the limits and reject things and very few users benefit from that.
Thanks!
@swankjesse @mjsaber By bounding the queue outside, do you mean doing something like the following? Will there be any performance impact for doing this check for every send request?
private void sendAsync(Request request) throws IOException {
if ((okHttpClient.dispatcher().queuedCallsCount())>=20000){
//log here say not sending anymore
//rate limited
logger.severe("Dropping the batch due to slower response time from server");
failureCount.accept(1);
return;
}
okHttpClient.newCall(request).enqueue(new Callback(){...});
}
That looks reasonable!
Me ayudarían a configurar Docker Buildx gracias.sera de gran ayuda