Optionally validate config on boot (#423)

This commit is contained in:
Lev Kokotov
2023-05-03 17:07:23 -07:00
committed by GitHub
parent 128ef72911
commit ba5243b6dd
2 changed files with 14 additions and 4 deletions

View File

@@ -459,10 +459,12 @@ impl ConnectionPool {
// Connect to the servers to make sure pool configuration is valid
// before setting it globally.
// Do this async and somewhere else, we don't have to wait here.
let mut validate_pool = pool.clone();
tokio::task::spawn(async move {
let _ = validate_pool.validate().await;
});
if config.general.validate_config {
let mut validate_pool = pool.clone();
tokio::task::spawn(async move {
let _ = validate_pool.validate().await;
});
}
// There is one pool per database/user pair.
new_pools.insert(PoolIdentifier::new(pool_name, &user.username), pool);