@@ -87,38 +87,39 @@ pub trait GeneratedData {
87
87
}
88
88
89
89
/// Refresh all the generated data of a given infra
90
+ #[ tracing:: instrument( level = "debug" , skip_all, fields( infra_id) ) ]
90
91
pub async fn refresh_all (
91
92
db_pool : Arc < DbConnectionPoolV2 > ,
92
- infra : i64 ,
93
+ infra_id : i64 ,
93
94
infra_cache : & InfraCache ,
94
95
) -> Result < ( ) > {
95
96
// The other layers depend on track section layer.
96
97
// We must wait until its completion before running the other requests in parallel
97
- TrackSectionLayer :: refresh_pool ( db_pool. clone ( ) , infra , infra_cache) . await ?;
98
- debug ! ( infra_id = infra , " Infra: track section layer is generated") ;
98
+ TrackSectionLayer :: refresh_pool ( db_pool. clone ( ) , infra_id , infra_cache) . await ?;
99
+ debug ! ( "⚙️ Infra {infra_id} : track section layer is generated") ;
99
100
// The analyze step significantly improves the performance when importing and generating together
100
101
// It doesn’t seem to make a different when the generation step is ran separately
101
102
// It isn’t clear why without analyze the Postgres server seems to run at 100% without halting
102
103
sql_query ( "analyze" )
103
104
. execute ( db_pool. get ( ) . await ?. deref_mut ( ) )
104
105
. await ?;
105
- debug ! ( "⚙️ Infra {infra }: database analyzed" ) ;
106
+ debug ! ( "⚙️ Infra {infra_id }: database analyzed" ) ;
106
107
futures:: try_join!(
107
- SpeedSectionLayer :: refresh_pool( db_pool. clone( ) , infra , infra_cache) ,
108
- SignalLayer :: refresh_pool( db_pool. clone( ) , infra , infra_cache) ,
109
- SwitchLayer :: refresh_pool( db_pool. clone( ) , infra , infra_cache) ,
110
- BufferStopLayer :: refresh_pool( db_pool. clone( ) , infra , infra_cache) ,
111
- ElectrificationLayer :: refresh_pool( db_pool. clone( ) , infra , infra_cache) ,
112
- DetectorLayer :: refresh_pool( db_pool. clone( ) , infra , infra_cache) ,
113
- OperationalPointLayer :: refresh_pool( db_pool. clone( ) , infra , infra_cache) ,
114
- PSLSignLayer :: refresh_pool( db_pool. clone( ) , infra , infra_cache) ,
115
- NeutralSectionLayer :: refresh_pool( db_pool. clone( ) , infra , infra_cache) ,
116
- NeutralSignLayer :: refresh_pool( db_pool. clone( ) , infra , infra_cache) ,
108
+ SpeedSectionLayer :: refresh_pool( db_pool. clone( ) , infra_id , infra_cache) ,
109
+ SignalLayer :: refresh_pool( db_pool. clone( ) , infra_id , infra_cache) ,
110
+ SwitchLayer :: refresh_pool( db_pool. clone( ) , infra_id , infra_cache) ,
111
+ BufferStopLayer :: refresh_pool( db_pool. clone( ) , infra_id , infra_cache) ,
112
+ ElectrificationLayer :: refresh_pool( db_pool. clone( ) , infra_id , infra_cache) ,
113
+ DetectorLayer :: refresh_pool( db_pool. clone( ) , infra_id , infra_cache) ,
114
+ OperationalPointLayer :: refresh_pool( db_pool. clone( ) , infra_id , infra_cache) ,
115
+ PSLSignLayer :: refresh_pool( db_pool. clone( ) , infra_id , infra_cache) ,
116
+ NeutralSectionLayer :: refresh_pool( db_pool. clone( ) , infra_id , infra_cache) ,
117
+ NeutralSignLayer :: refresh_pool( db_pool. clone( ) , infra_id , infra_cache) ,
117
118
) ?;
118
- debug ! ( "⚙️ Infra {infra }: object layers is generated" ) ;
119
+ debug ! ( "⚙️ Infra {infra_id }: object layers is generated" ) ;
119
120
// The error layer depends on the other layers and must be executed at the end.
120
- ErrorLayer :: refresh_pool ( db_pool. clone ( ) , infra , infra_cache) . await ?;
121
- debug ! ( "⚙️ Infra {infra }: errors layer is generated" ) ;
121
+ ErrorLayer :: refresh_pool ( db_pool. clone ( ) , infra_id , infra_cache) . await ?;
122
+ debug ! ( "⚙️ Infra {infra_id }: errors layer is generated" ) ;
122
123
Ok ( ( ) )
123
124
}
124
125
0 commit comments