From b915d051869f2aa589bccd99d7d365197fd95bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BA=B8=E6=9D=AFgg?= <92575122+zhibeigg@users.noreply.github.com> Date: Mon, 1 Dec 2025 11:39:16 +0800 Subject: [PATCH] Add KeepaliveTime to datasource configuration Added KeepaliveTime property to control connection testing interval. --- module/database/src/main/resources/datasource.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/module/database/src/main/resources/datasource.yml b/module/database/src/main/resources/datasource.yml index 3da021d75..2916d919b 100644 --- a/module/database/src/main/resources/datasource.yml +++ b/module/database/src/main/resources/datasource.yml @@ -42,6 +42,10 @@ DefaultSettings: # A value of 0 indicates no maximum lifetime (infinite lifetime), subject of course to the idleTimeout setting. # The minimum allowed value is 30000ms (30 seconds). Default: 1800000 (30 minutes) MaxLifetime: 1800000 + # This property controls the keepalive interval for a connection in the pool. An in-use connection will never be + # tested by the keepalive thread, only when it is idle will it be tested. + # keepaliveTimeMs the interval in which connections will be tested for aliveness, thus keeping them alive by the act of checking. Value is in milliseconds, default is 0 (disabled). + KeepaliveTime: 300000 # If your driver supports JDBC4 we strongly recommend not setting this property. # This is for "legacy" drivers that do not support the JDBC4 Connection.isValid() API. # This is the query that will be executed just before a connection is given to you from the pool to validate that the connection to the database is still alive. @@ -64,4 +68,4 @@ DefaultSettings: cachePrepStmts: true # Newer versions of MySQL support server-side prepared statements, this can provide a substantial performance boost. # Set this property to true. - useServerPrepStmts: true \ No newline at end of file + useServerPrepStmts: true