reduce connection keepalive timeout to 30s, default is 20 minutes

This commit is contained in:
Athou
2023-12-22 20:16:18 +01:00
parent 5601d150c3
commit 1db53e48c6

View File

@@ -31,6 +31,14 @@ import nl.altindag.ssl.SSLFactory;
@Singleton
public class HttpGetter {
static {
// reduce connection keepalive timeout to 30s, default is 20 minutes
// https://stackoverflow.com/a/53620696/1885506
// will no longer be needed with Java 21+
// https://bugs.openjdk.org/browse/JDK-8297030
System.setProperty("jdk.httpclient.keepalive.timeout", "30");
}
private final HttpClient client;
private final String userAgent;