Skip to content

Commit b3bd952

Browse files
committed
editoast: replace infra by infra_id in refresh_all
1 parent a9a78ad commit b3bd952

File tree

1 file changed

+18
-17
lines changed
  • editoast/src/generated_data

1 file changed

+18
-17
lines changed

editoast/src/generated_data/mod.rs

+18-17
Original file line numberDiff line numberDiff line change
@@ -87,38 +87,39 @@ pub trait GeneratedData {
8787
}
8888

8989
/// Refresh all the generated data of a given infra
90+
#[tracing::instrument(level = "debug", skip_all, fields(infra_id))]
9091
pub async fn refresh_all(
9192
db_pool: Arc<DbConnectionPoolV2>,
92-
infra: i64,
93+
infra_id: i64,
9394
infra_cache: &InfraCache,
9495
) -> Result<()> {
9596
// The other layers depend on track section layer.
9697
// 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");
99100
// The analyze step significantly improves the performance when importing and generating together
100101
// It doesn’t seem to make a different when the generation step is ran separately
101102
// It isn’t clear why without analyze the Postgres server seems to run at 100% without halting
102103
sql_query("analyze")
103104
.execute(db_pool.get().await?.deref_mut())
104105
.await?;
105-
debug!("⚙️ Infra {infra}: database analyzed");
106+
debug!("⚙️ Infra {infra_id}: database analyzed");
106107
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),
117118
)?;
118-
debug!("⚙️ Infra {infra}: object layers is generated");
119+
debug!("⚙️ Infra {infra_id}: object layers is generated");
119120
// 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");
122123
Ok(())
123124
}
124125

0 commit comments

Comments
 (0)