Skip to content

Commit a70b95b

Browse files
committed
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)
1 parent 85350b2 commit a70b95b

File tree

1 file changed

+6
-0
lines changed
  • app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins

1 file changed

+6
-0
lines changed

app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/PostgresPlugin.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ public class PostgresPlugin extends BasePlugin {
5454

5555
private static final int MAXIMUM_POOL_SIZE = 5;
5656

57+
private static final long LEAK_DETECTION_TIME_MS = 60*1000;
58+
5759
public PostgresPlugin(PluginWrapper wrapper) {
5860
super(wrapper);
5961
}
@@ -540,6 +542,10 @@ private static HikariDataSource createConnectionPool(DatasourceConfiguration dat
540542
}
541543
config.setJdbcUrl(url);
542544

545+
// Configuring leak detection threshold for 60 seconds. Any connection which hasn't been released in 60 seconds
546+
// should get tracked (may be falsely for long running queries) as leaked connection
547+
config.setLeakDetectionThreshold(LEAK_DETECTION_TIME_MS);
548+
543549
// Now create the connection pool from the configuration
544550
HikariDataSource datasource = new HikariDataSource(config);
545551

0 commit comments

Comments
 (0)