File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -298,6 +298,9 @@ pub struct General {
298
298
pub admin_username : String ,
299
299
pub admin_password : String ,
300
300
301
+ #[ serde( default = "General::default_validate_config" ) ]
302
+ pub validate_config : bool ,
303
+
301
304
// Support for auth query
302
305
pub auth_query : Option < String > ,
303
306
pub auth_query_user : Option < String > ,
@@ -367,6 +370,10 @@ impl General {
367
370
pub fn default_idle_client_in_transaction_timeout ( ) -> u64 {
368
371
0
369
372
}
373
+
374
+ pub fn default_validate_config ( ) -> bool {
375
+ true
376
+ }
370
377
}
371
378
372
379
impl Default for General {
@@ -402,6 +409,7 @@ impl Default for General {
402
409
auth_query_user : None ,
403
410
auth_query_password : None ,
404
411
server_lifetime : 1000 * 3600 * 24 , // 24 hours,
412
+ validate_config : true ,
405
413
}
406
414
}
407
415
}
Original file line number Diff line number Diff line change @@ -459,10 +459,12 @@ impl ConnectionPool {
459
459
// Connect to the servers to make sure pool configuration is valid
460
460
// before setting it globally.
461
461
// Do this async and somewhere else, we don't have to wait here.
462
- let mut validate_pool = pool. clone ( ) ;
463
- tokio:: task:: spawn ( async move {
464
- let _ = validate_pool. validate ( ) . await ;
465
- } ) ;
462
+ if config. general . validate_config {
463
+ let mut validate_pool = pool. clone ( ) ;
464
+ tokio:: task:: spawn ( async move {
465
+ let _ = validate_pool. validate ( ) . await ;
466
+ } ) ;
467
+ }
466
468
467
469
// There is one pool per database/user pair.
468
470
new_pools. insert ( PoolIdentifier :: new ( pool_name, & user. username ) , pool) ;
You can’t perform that action at this time.
0 commit comments