@@ -28,7 +28,11 @@ private void InitDefaultValues()
2828 _host = YdbAdoDefaultSettings . Host ;
2929 _port = YdbAdoDefaultSettings . Port ;
3030 _database = YdbAdoDefaultSettings . Database ;
31+ _minSessionPool = 0 ;
3132 _maxSessionPool = SessionPoolDefaultSettings . MaxSessionPool ;
33+ _createSessionTimeout = SessionPoolDefaultSettings . CreateSessionTimeoutSeconds ;
34+ _sessionIdleTimeout = 300 ;
35+ _sessionPruningInterval = 10 ;
3236 _useTls = YdbAdoDefaultSettings . UseTls ;
3337 _connectTimeout = GrpcDefaultSettings . ConnectTimeoutSeconds ;
3438 _keepAlivePingDelay = GrpcDefaultSettings . KeepAlivePingSeconds ;
@@ -37,7 +41,6 @@ private void InitDefaultValues()
3741 _maxSendMessageSize = GrpcDefaultSettings . MaxSendMessageSize ;
3842 _maxReceiveMessageSize = GrpcDefaultSettings . MaxReceiveMessageSize ;
3943 _disableDiscovery = GrpcDefaultSettings . DisableDiscovery ;
40- _createSessionTimeout = SessionPoolDefaultSettings . CreateSessionTimeoutSeconds ;
4144 _disableServerBalancer = false ;
4245 }
4346
@@ -123,6 +126,58 @@ public int MaxSessionPool
123126
124127 private int _maxSessionPool ;
125128
129+ public int MinSessionPool
130+ {
131+ get => _minSessionPool ;
132+ set
133+ {
134+ if ( value < 0 )
135+ {
136+ throw new ArgumentOutOfRangeException ( nameof ( value ) , value , "Invalid min session pool: " + value ) ;
137+ }
138+
139+ _minSessionPool = value ;
140+ SaveValue ( nameof ( MinSessionPool ) , value ) ;
141+ }
142+ }
143+
144+ private int _minSessionPool ;
145+
146+ public int SessionIdleTimeout
147+ {
148+ get => _sessionIdleTimeout ;
149+ set
150+ {
151+ if ( value < 0 )
152+ {
153+ throw new ArgumentOutOfRangeException ( nameof ( value ) , value , "Invalid session idle timeout: " + value ) ;
154+ }
155+
156+ _sessionIdleTimeout = value ;
157+ SaveValue ( nameof ( SessionIdleTimeout ) , value ) ;
158+ }
159+ }
160+
161+ private int _sessionIdleTimeout ;
162+
163+ public int SessionPruningInterval
164+ {
165+ get => _sessionPruningInterval ;
166+ set
167+ {
168+ if ( value <= 0 )
169+ {
170+ throw new ArgumentOutOfRangeException ( nameof ( value ) , value ,
171+ "Invalid session pruning interval: " + value ) ;
172+ }
173+
174+ _sessionPruningInterval = value ;
175+ SaveValue ( nameof ( SessionPruningInterval ) , value ) ;
176+ }
177+ }
178+
179+ private int _sessionPruningInterval ;
180+
126181 public bool UseTls
127182 {
128183 get => _useTls ;
@@ -416,9 +471,12 @@ static YdbConnectionOption()
416471 ( builder , user ) => builder . User = user ) , "User" , "Username" , "UserId" , "User Id" ) ;
417472 AddOption ( new YdbConnectionOption < string > ( StringExtractor ,
418473 ( builder , password ) => builder . Password = password ) , "Password" , "PWD" , "PSW" ) ;
419- AddOption ( new YdbConnectionOption < int > ( IntExtractor ,
420- ( builder , maxSessionPool ) => builder . MaxSessionPool = maxSessionPool ) ,
421- "MaxSessionPool" , "Max Session Pool" , "Maximum Pool Size" , "Max Pool Size" , "MaximumPoolSize" ) ;
474+ AddOption ( new YdbConnectionOption < int > ( IntExtractor , ( builder , maxSessionPool ) =>
475+ builder . MaxSessionPool = maxSessionPool ) , "MaxSessionPool" , "Max Session Pool" , "Maximum Pool Size" ,
476+ "MaximumPoolSize" , "Max Pool Size" , "MaxPoolSize" ) ;
477+ AddOption ( new YdbConnectionOption < int > ( IntExtractor , ( builder , minSessionSize ) =>
478+ builder . MinSessionPool = minSessionSize ) , "MinSessionPool" , "Min Session Pool" , "Minimum Pool Size" ,
479+ "MinimumPoolSize" , "Min Pool Size" , "MinPoolSize" ) ;
422480 AddOption ( new YdbConnectionOption < bool > ( BoolExtractor , ( builder , useTls ) => builder . UseTls = useTls ) ,
423481 "UseTls" , "Use Tls" ) ;
424482 AddOption ( new YdbConnectionOption < string > ( StringExtractor ,
@@ -446,8 +504,14 @@ static YdbConnectionOption()
446504 AddOption ( new YdbConnectionOption < int > ( IntExtractor ,
447505 ( builder , createSessionTimeout ) => builder . CreateSessionTimeout = createSessionTimeout ) ,
448506 "CreateSessionTimeout" , "Create Session Timeout" ) ;
449- AddOption ( new YdbConnectionOption < bool > ( BoolExtractor , ( builder , disableServerBalancer ) =>
450- builder . DisableServerBalancer = disableServerBalancer ) ,
507+ AddOption ( new YdbConnectionOption < int > ( IntExtractor ,
508+ ( builder , sessionIdleTimeout ) => builder . SessionIdleTimeout = sessionIdleTimeout ) ,
509+ "SessionIdleTimeout" , "Session Idle Timeout" ) ;
510+ AddOption ( new YdbConnectionOption < int > ( IntExtractor ,
511+ ( builder , sessionPruningInterval ) => builder . SessionPruningInterval = sessionPruningInterval ) ,
512+ "SessionPruningInterval" , "Session Pruning Interval" ) ;
513+ AddOption ( new YdbConnectionOption < bool > ( BoolExtractor ,
514+ ( builder , disableServerBalancer ) => builder . DisableServerBalancer = disableServerBalancer ) ,
451515 "DisableServerBalancer" , "Disable Server Balancer" ) ;
452516 }
453517
0 commit comments