Adding leak detection to hikari pool. Would be tracking this on logdna to ensure that we are catching any and all leaks that may be occuring with hikari. (#2374)

This commit is contained in:
Trisha Anand 2020-12-28 18:26:33 +05:30 committed by GitHub
parent 988ebe975b
commit 051d3c6c7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,6 +54,8 @@ public class PostgresPlugin extends BasePlugin {
private static final int MAXIMUM_POOL_SIZE = 5;
private static final long LEAK_DETECTION_TIME_MS = 60*1000;
public PostgresPlugin(PluginWrapper wrapper) {
super(wrapper);
}
@ -540,6 +542,10 @@ public class PostgresPlugin extends BasePlugin {
}
config.setJdbcUrl(url);
// Configuring leak detection threshold for 60 seconds. Any connection which hasn't been released in 60 seconds
// should get tracked (may be falsely for long running queries) as leaked connection
config.setLeakDetectionThreshold(LEAK_DETECTION_TIME_MS);
// Now create the connection pool from the configuration
HikariDataSource datasource = new HikariDataSource(config);