aboutsummaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/Cargo.toml1
-rw-r--r--server/src/import.rs12
2 files changed, 11 insertions, 2 deletions
diff --git a/server/Cargo.toml b/server/Cargo.toml
index 6648b80..d800983 100644
--- a/server/Cargo.toml
+++ b/server/Cargo.toml
@@ -27,6 +27,7 @@ aes-gcm-siv = "0.11.1"
async-std = "1.12.0"
async-recursion = "1.0.4"
+futures = "0.3.28"
tokio = { version = "1.29.1", features = ["io-util"] }
tokio-util = { version = "0.7.8", features = ["io", "io-util"] }
diff --git a/server/src/import.rs b/server/src/import.rs
index 6ea8268..374c2c7 100644
--- a/server/src/import.rs
+++ b/server/src/import.rs
@@ -7,6 +7,7 @@ use crate::{database::Database, federation::Federation, CONF};
use anyhow::{anyhow, bail, Context, Ok};
use async_recursion::async_recursion;
use base64::Engine;
+use futures::future::join_all;
use jellyclient::Session;
use jellycommon::{AssetLocation, MediaSource, Node, NodePrivate, RemoteImportOptions};
use log::{debug, error, info};
@@ -55,10 +56,17 @@ pub async fn import_path(
}
});
let identifier = path.file_name().unwrap().to_str().unwrap().to_string();
+
+ let all = join_all(
+ children_paths
+ .into_iter()
+ .map(|p| import_path(p, db, fed, Some(identifier.clone()))),
+ )
+ .await;
+
let mut children_ids = Vec::new();
let mut errs = 0;
- for p in children_paths {
- let k = import_path(p, db, fed, Some(identifier.clone())).await;
+ for k in all {
match k {
core::result::Result::Ok((els, errs2)) => {
errs += errs2;