@@ -190,11 +190,11 @@ impl Default for PoolSettings {
190
190
#[ derive( Clone , Debug , Default ) ]
191
191
pub struct ConnectionPool {
192
192
/// The pools handled internally by bb8.
193
- databases : Vec < Vec < Pool < ServerPool > > > ,
193
+ databases : Arc < Vec < Vec < Pool < ServerPool > > > > ,
194
194
195
195
/// The addresses (host, port, role) to handle
196
196
/// failover and load balancing deterministically.
197
- addresses : Vec < Vec < Address > > ,
197
+ addresses : Arc < Vec < Vec < Address > > > ,
198
198
199
199
/// List of banned addresses (see above)
200
200
/// that should not be queried.
@@ -206,7 +206,7 @@ pub struct ConnectionPool {
206
206
original_server_parameters : Arc < RwLock < ServerParameters > > ,
207
207
208
208
/// Pool configuration.
209
- pub settings : PoolSettings ,
209
+ pub settings : Arc < PoolSettings > ,
210
210
211
211
/// If not validated, we need to double check the pool is available before allowing a client
212
212
/// to use it.
@@ -445,13 +445,13 @@ impl ConnectionPool {
445
445
}
446
446
447
447
let pool = ConnectionPool {
448
- databases : shards,
449
- addresses,
448
+ databases : Arc :: new ( shards) ,
449
+ addresses : Arc :: new ( addresses ) ,
450
450
banlist : Arc :: new ( RwLock :: new ( banlist) ) ,
451
451
config_hash : new_pool_hash_value,
452
452
original_server_parameters : Arc :: new ( RwLock :: new ( ServerParameters :: new ( ) ) ) ,
453
453
auth_hash : pool_auth_hash,
454
- settings : PoolSettings {
454
+ settings : Arc :: new ( PoolSettings {
455
455
pool_mode : match user. pool_mode {
456
456
Some ( pool_mode) => pool_mode,
457
457
None => pool_config. pool_mode ,
@@ -494,7 +494,7 @@ impl ConnectionPool {
494
494
Some ( ref plugins) => Some ( plugins. clone ( ) ) ,
495
495
None => config. plugins . clone ( ) ,
496
496
} ,
497
- } ,
497
+ } ) ,
498
498
validated : Arc :: new ( AtomicBool :: new ( false ) ) ,
499
499
paused : Arc :: new ( AtomicBool :: new ( false ) ) ,
500
500
paused_waiter : Arc :: new ( Notify :: new ( ) ) ,
@@ -504,7 +504,7 @@ impl ConnectionPool {
504
504
// before setting it globally.
505
505
// Do this async and somewhere else, we don't have to wait here.
506
506
if config. general . validate_config {
507
- let mut validate_pool = pool. clone ( ) ;
507
+ let validate_pool = pool. clone ( ) ;
508
508
tokio:: task:: spawn ( async move {
509
509
let _ = validate_pool. validate ( ) . await ;
510
510
} ) ;
@@ -525,7 +525,7 @@ impl ConnectionPool {
525
525
/// when they connect.
526
526
/// This also warms up the pool for clients that connect when
527
527
/// the pooler starts up.
528
- pub async fn validate ( & mut self ) -> Result < ( ) , Error > {
528
+ pub async fn validate ( & self ) -> Result < ( ) , Error > {
529
529
let mut futures = Vec :: new ( ) ;
530
530
let validated = Arc :: clone ( & self . validated ) ;
531
531
0 commit comments