Fix #1818 Add system property for minimum login timeout, regardless of the connectionTimeout (#1820)

pull/1838/merge
Kwangyong Kim 1 year ago committed by GitHub
parent 8c202e4554
commit 5b2852e8bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -69,6 +69,7 @@ abstract class PoolBase
private static final int UNINITIALIZED = -1;
private static final int TRUE = 1;
private static final int FALSE = 0;
private static final int MINIMUM_LOGIN_TIMEOUT = Integer.getInteger("com.zaxxer.hikari.minimumLoginTimeoutSecs", 1);
private int networkTimeout;
private int isNetworkTimeoutSupported;
@ -616,7 +617,7 @@ abstract class PoolBase
{
if (connectionTimeout != Integer.MAX_VALUE) {
try {
dataSource.setLoginTimeout(Math.max(1, (int) MILLISECONDS.toSeconds(500L + connectionTimeout)));
dataSource.setLoginTimeout(Math.max(MINIMUM_LOGIN_TIMEOUT, (int) MILLISECONDS.toSeconds(500L + connectionTimeout)));
}
catch (Exception e) {
logger.info("{} - Failed to set login timeout for data source. ({})", poolName, e.getMessage());

Loading…
Cancel
Save