fix bug from issue

This commit is contained in:
inrgihc
2023-06-02 21:28:50 +08:00
parent 4e6e2f3fab
commit 256b2fcafb
4 changed files with 14 additions and 8 deletions

View File

@@ -11,6 +11,12 @@ services:
MYSQL_PASSWORD: 123456
MYSQL_ROOT_PASSWORD: 123456
MYSQL_ROOT_HOST: '%'
healthcheck:
test: ["CMD", "mysql", "-uroot", "-p123456" ,"-e"," select 1 "]
interval: 10s
timeout: 3s
retries: 60
start_period: 30s
dbswitch:
container_name: dbswitch_webui
image: inrgihc/dbswitch:1.7.0

View File

@@ -75,11 +75,6 @@ public final class JDBCURL {
*/
public static boolean reachable(String host, String port) {
try {
InetAddress address = InetAddress.getByName(host);
if (!address.isReachable(1500)) {
return false;
}
try (Socket socket = new Socket()) {
socket.connect(new InetSocketAddress(host, Integer.parseInt(port)), 1500);
}

View File

@@ -56,7 +56,7 @@ import org.springframework.util.StringUtils;
@Slf4j
public class MigrationHandler implements Supplier<Long> {
private final long MAX_CACHE_BYTES_SIZE = 128 * 1024 * 1024;
private final long MAX_CACHE_BYTES_SIZE = 512 * 1024 * 1024;
private int fetchSize = 100;
private final DbswichProperties properties;

View File

@@ -111,8 +111,13 @@ public final class DataSourceUtils {
} else {
ds.setConnectionTestQuery("SELECT 1");
}
if (properties.getDriverClassName().contains("sqlite")) {
ds.setMaximumPoolSize(1);
ds.setMinimumIdle(1);
} else {
ds.setMaximumPoolSize(MAX_THREAD_COUNT);
ds.setMinimumIdle(MAX_THREAD_COUNT);
}
ds.setMaxLifetime(properties.getMaxLifeTime());
ds.setConnectionTimeout(properties.getConnectionTimeout());
ds.setIdleTimeout(MAX_TIMEOUT_MS);