@@ -190,11 +190,11 @@ impl Default for PoolSettings {
190190#[ derive( Clone , Debug , Default ) ]
191191pub struct ConnectionPool {
192192 /// The pools handled internally by bb8.
193- databases : Vec < Vec < Pool < ServerPool > > > ,
193+ databases : Arc < Vec < Vec < Pool < ServerPool > > > > ,
194194
195195 /// The addresses (host, port, role) to handle
196196 /// failover and load balancing deterministically.
197- addresses : Vec < Vec < Address > > ,
197+ addresses : Arc < Vec < Vec < Address > > > ,
198198
199199 /// List of banned addresses (see above)
200200 /// that should not be queried.
@@ -206,7 +206,7 @@ pub struct ConnectionPool {
206206 original_server_parameters : Arc < RwLock < ServerParameters > > ,
207207
208208 /// Pool configuration.
209- pub settings : PoolSettings ,
209+ pub settings : Arc < PoolSettings > ,
210210
211211 /// If not validated, we need to double check the pool is available before allowing a client
212212 /// to use it.
@@ -445,13 +445,13 @@ impl ConnectionPool {
445445 }
446446
447447 let pool = ConnectionPool {
448- databases : shards,
449- addresses,
448+ databases : Arc :: new ( shards) ,
449+ addresses : Arc :: new ( addresses ) ,
450450 banlist : Arc :: new ( RwLock :: new ( banlist) ) ,
451451 config_hash : new_pool_hash_value,
452452 original_server_parameters : Arc :: new ( RwLock :: new ( ServerParameters :: new ( ) ) ) ,
453453 auth_hash : pool_auth_hash,
454- settings : PoolSettings {
454+ settings : Arc :: new ( PoolSettings {
455455 pool_mode : match user. pool_mode {
456456 Some ( pool_mode) => pool_mode,
457457 None => pool_config. pool_mode ,
@@ -494,7 +494,7 @@ impl ConnectionPool {
494494 Some ( ref plugins) => Some ( plugins. clone ( ) ) ,
495495 None => config. plugins . clone ( ) ,
496496 } ,
497- } ,
497+ } ) ,
498498 validated : Arc :: new ( AtomicBool :: new ( false ) ) ,
499499 paused : Arc :: new ( AtomicBool :: new ( false ) ) ,
500500 paused_waiter : Arc :: new ( Notify :: new ( ) ) ,
@@ -504,7 +504,7 @@ impl ConnectionPool {
504504 // before setting it globally.
505505 // Do this async and somewhere else, we don't have to wait here.
506506 if config. general . validate_config {
507- let mut validate_pool = pool. clone ( ) ;
507+ let validate_pool = pool. clone ( ) ;
508508 tokio:: task:: spawn ( async move {
509509 let _ = validate_pool. validate ( ) . await ;
510510 } ) ;
@@ -525,7 +525,7 @@ impl ConnectionPool {
525525 /// when they connect.
526526 /// This also warms up the pool for clients that connect when
527527 /// the pooler starts up.
528- pub async fn validate ( & mut self ) -> Result < ( ) , Error > {
528+ pub async fn validate ( & self ) -> Result < ( ) , Error > {
529529 let mut futures = Vec :: new ( ) ;
530530 let validated = Arc :: clone ( & self . validated ) ;
531531
0 commit comments