Skip to content

Commit

Permalink
use the same defaults for session pool config as in the sdk
Browse files Browse the repository at this point in the history
fixes #92
  • Loading branch information
Artem Sinitsyn committed Nov 1, 2024
1 parent 50a81f5 commit e7723a8
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
@Builder
public class YdbConfig {
private static final Duration SESSION_KEEP_ALIVE_TIME_DEFAULT = Duration.ofMinutes(5);
private static final Duration SESSION_MAX_IDLE_TIME_DEFAULT = Duration.ofMinutes(5);
private static final Duration SESSION_MAX_IDLE_TIME_DEFAULT = Duration.ofMinutes(1);
private static final Duration TCP_KEEP_ALIVE_TIME_DEFAULT = Duration.ofSeconds(5);
private static final Duration TCP_KEEP_ALIVE_TIMEOUT_DEFAULT = Duration.ofSeconds(1);
private static final Duration SESSION_CREATE_TIMEOUT_DEFAULT = Duration.ofSeconds(1);
private static final int SESSION_POOL_SIZE_DEFAULT = 100;
private static final int SESSION_POOL_SIZE_MAX_DEFAULT = 50;
private static final int SESSION_POOL_SIZE_MIN_DEFAULT = 10;
private static final int SESSION_CREATE_RETRY_COUNT_DEFAULT = 3;

public static YdbConfig createForTesting(String host, int port, String tablespace, String database) {
Expand All @@ -30,8 +31,8 @@ public static YdbConfig createForTesting(String host, int port, String tablespac
SESSION_CREATE_RETRY_COUNT_DEFAULT,
SESSION_KEEP_ALIVE_TIME_DEFAULT,
SESSION_MAX_IDLE_TIME_DEFAULT,
SESSION_POOL_SIZE_DEFAULT,
SESSION_POOL_SIZE_DEFAULT,
SESSION_POOL_SIZE_MIN_DEFAULT,
SESSION_POOL_SIZE_MAX_DEFAULT,
TCP_KEEP_ALIVE_TIME_DEFAULT,
TCP_KEEP_ALIVE_TIMEOUT_DEFAULT,
false,
Expand Down Expand Up @@ -118,11 +119,11 @@ public Duration getSessionMaxIdleTime() {
}

public Integer getSessionPoolMin() {
return Optional.ofNullable(sessionPoolMin).orElse(SESSION_POOL_SIZE_DEFAULT);
return Optional.ofNullable(sessionPoolMin).orElse(SESSION_POOL_SIZE_MIN_DEFAULT);
}

public Integer getSessionPoolMax() {
return Optional.ofNullable(sessionPoolMax).orElse(SESSION_POOL_SIZE_DEFAULT);
return Optional.ofNullable(sessionPoolMax).orElse(SESSION_POOL_SIZE_MAX_DEFAULT);
}

public Duration getTcpKeepaliveTime() {
Expand Down

0 comments on commit e7723a8

Please sign in to comment.