From 8dd2535de9aa3504a8b4c27eb8ecb1a12256ecbf Mon Sep 17 00:00:00 2001 From: Brett Wooldridge Date: Sat, 23 Nov 2024 04:02:28 +0900 Subject: [PATCH] increase keepaliveTime variance --- CHANGES | 4 ++++ src/main/java/com/zaxxer/hikari/pool/HikariPool.java | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 14586f4d..12c897db 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,9 @@ HikariCP Changes +Changes in 6.2.2 + + * increase keepaliveTime variance from 10% to 20% + Changes in 6.2.1 * change default keepaliveTime to 2 minutes diff --git a/src/main/java/com/zaxxer/hikari/pool/HikariPool.java b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java index 002fcd69..765ed985 100644 --- a/src/main/java/com/zaxxer/hikari/pool/HikariPool.java +++ b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java @@ -493,8 +493,8 @@ public final class HikariPool extends PoolBase implements HikariPoolMXBean, IBag final long keepaliveTime = config.getKeepaliveTime(); if (keepaliveTime > 0) { - // variance up to 10% of the heartbeat time - final var variance = ThreadLocalRandom.current().nextLong(keepaliveTime / 10); + // variance up to 20% of the heartbeat time + final var variance = ThreadLocalRandom.current().nextLong(keepaliveTime / 5); final var heartbeatTime = keepaliveTime - variance; poolEntry.setKeepalive(houseKeepingExecutorService.scheduleWithFixedDelay(new KeepaliveTask(poolEntry), heartbeatTime, heartbeatTime, MILLISECONDS)); }