Skip to content

Commit

Permalink
Adding leak detection to hikari pool. Would be tracking this on logdn…
Browse files Browse the repository at this point in the history
…a to ensure that we are catching any and all leaks that may be occuring with hikari. (#2374)
  • Loading branch information
trishaanand committed Dec 28, 2020
1 parent 85350b2 commit a70b95b
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -540,6 +542,10 @@ private static HikariDataSource createConnectionPool(DatasourceConfiguration dat
}
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);

Expand Down

0 comments on commit a70b95b

Please sign in to comment.