mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-23 09:08:32 +02:00
Batch insert environments last, to handle folder case
This commit is contained in:
@@ -49,15 +49,7 @@ impl<'a> DbContext<'a> {
|
||||
info!("Upserted {} websocket_requests", imported_resources.websocket_requests.len());
|
||||
}
|
||||
|
||||
if environments.len() > 0 {
|
||||
for x in environments {
|
||||
let x = self.upsert_environment(&x, source)?;
|
||||
imported_resources.environments.push(x.clone());
|
||||
}
|
||||
info!("Upserted {} environments", imported_resources.environments.len());
|
||||
}
|
||||
|
||||
// Do folders last so it doesn't cause the UI to render empty folders before populating
|
||||
// Do folders after their children so the UI doesn't render empty folders before populating
|
||||
// immediately after.
|
||||
if folders.len() > 0 {
|
||||
for v in folders {
|
||||
@@ -67,6 +59,15 @@ impl<'a> DbContext<'a> {
|
||||
info!("Upserted {} folders", imported_resources.folders.len());
|
||||
}
|
||||
|
||||
// Do environments last because they can depend on many models (requests, folders, etc)
|
||||
if environments.len() > 0 {
|
||||
for x in environments {
|
||||
let x = self.upsert_environment(&x, source)?;
|
||||
imported_resources.environments.push(x.clone());
|
||||
}
|
||||
info!("Upserted {} environments", imported_resources.environments.len());
|
||||
}
|
||||
|
||||
Ok(imported_resources)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user