@@ -41,7 +41,7 @@ use dashmap::DashMap;
41
41
use editoast_authz:: authorizer:: Authorizer ;
42
42
use editoast_authz:: authorizer:: UserInfo ;
43
43
use editoast_authz:: BuiltinRole ;
44
- use editoast_models :: DbConnectionPool ;
44
+
45
45
use editoast_osrdyne_client:: OsrdyneClient ;
46
46
use futures:: TryFutureExt ;
47
47
pub use openapi:: OpenApiRoot ;
@@ -225,7 +225,7 @@ async fn authenticate(
225
225
226
226
async fn authentication_middleware (
227
227
State ( AppState {
228
- db_pool_v2 : db_pool,
228
+ db_pool,
229
229
disable_authorization,
230
230
..
231
231
} ) : State < AppState > ,
@@ -278,7 +278,7 @@ pub enum AppHealthError {
278
278
) ]
279
279
async fn health (
280
280
State ( AppState {
281
- db_pool_v2 : db_pool,
281
+ db_pool,
282
282
valkey,
283
283
health_check_timeout,
284
284
core_client,
@@ -384,8 +384,7 @@ pub struct Server {
384
384
pub struct AppState {
385
385
pub config : Arc < ServerConfig > ,
386
386
387
- pub db_pool_v1 : Arc < DbConnectionPool > ,
388
- pub db_pool_v2 : Arc < DbConnectionPoolV2 > ,
387
+ pub db_pool : Arc < DbConnectionPoolV2 > ,
389
388
pub valkey : Arc < ValkeyClient > ,
390
389
pub infra_caches : Arc < DashMap < i64 , InfraCache > > ,
391
390
pub map_layers : Arc < MapLayers > ,
@@ -398,7 +397,7 @@ pub struct AppState {
398
397
399
398
impl FromRef < AppState > for DbConnectionPoolV2 {
400
399
fn from_ref ( input : & AppState ) -> Self {
401
- ( * input. db_pool_v2 ) . clone ( )
400
+ ( * input. db_pool ) . clone ( )
402
401
}
403
402
}
404
403
@@ -409,16 +408,15 @@ impl AppState {
409
408
// Config database
410
409
let valkey = ValkeyClient :: new ( config. valkey_config . clone ( ) ) ?. into ( ) ;
411
410
412
- // Create both database pools
413
- let db_pool_v2 = {
411
+ // Create database pool
412
+ let db_pool = {
414
413
let PostgresConfig {
415
414
database_url,
416
415
pool_size,
417
416
} = config. postgres_config . clone ( ) ;
418
- DbConnectionPoolV2 :: try_initialize ( database_url, pool_size) . await ?
417
+ let pool = DbConnectionPoolV2 :: try_initialize ( database_url, pool_size) . await ?;
418
+ Arc :: new ( pool)
419
419
} ;
420
- let db_pool_v1 = db_pool_v2. pool_v1 ( ) ;
421
- let db_pool_v2 = Arc :: new ( db_pool_v2) ;
422
420
423
421
// Setup infra cache map
424
422
let infra_caches = DashMap :: < i64 , InfraCache > :: default ( ) . into ( ) ;
@@ -449,8 +447,7 @@ impl AppState {
449
447
450
448
Ok ( Self {
451
449
valkey,
452
- db_pool_v1,
453
- db_pool_v2,
450
+ db_pool,
454
451
infra_caches,
455
452
core_client,
456
453
osrdyne_client,
0 commit comments