fix: reset vector with every 1000 tasks

This commit is contained in:
Namekuji 2023-09-18 01:41:41 -04:00
parent ffe3b8ffec
commit ffbb0528d9
No known key found for this signature in database
GPG key ID: 1D62332C07FBA532
4 changed files with 20 additions and 33 deletions

View file

@ -2466,7 +2466,6 @@ dependencies = [
"serde", "serde",
"serde_yaml", "serde_yaml",
"thiserror", "thiserror",
"tikv-jemallocator",
"tokio", "tokio",
"urlencoding", "urlencoding",
] ]
@ -3252,26 +3251,6 @@ dependencies = [
"once_cell", "once_cell",
] ]
[[package]]
name = "tikv-jemalloc-sys"
version = "0.5.4+5.3.0-patched"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9402443cb8fd499b6f327e40565234ff34dbda27460c5b47db0db77443dd85d1"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "tikv-jemallocator"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "965fe0c26be5c56c94e38ba547249074803efd52adfb66de62107d95aab3eaca"
dependencies = [
"libc",
"tikv-jemalloc-sys",
]
[[package]] [[package]]
name = "time" name = "time"
version = "0.1.45" version = "0.1.45"

View file

@ -18,6 +18,3 @@ serde_yaml = "0.9.22"
thiserror = "1.0.43" thiserror = "1.0.43"
tokio = { version = "1.29.1", features = ["full"] } tokio = { version = "1.29.1", features = ["full"] }
urlencoding = "2.1.3" urlencoding = "2.1.3"
[target.'cfg(not(target_env = "msvc"))'.dependencies]
tikv-jemallocator = "0.5.4"

View file

@ -1,10 +1,3 @@
#[cfg(not(target_env = "msvc"))]
use tikv_jemallocator::Jemalloc;
#[cfg(not(target_env = "msvc"))]
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;
use scylla_migration::{cli::run_cli, error::Error}; use scylla_migration::{cli::run_cli, error::Error};
#[tokio::main] #[tokio::main]

View file

@ -214,6 +214,11 @@ impl Initializer {
}); });
tasks.push(handler); tasks.push(handler);
} }
if tasks.len() > 1000 {
future::join_all(tasks).await;
tasks = Vec::new()
}
} }
let mut reactions = note_reaction::Entity::find() let mut reactions = note_reaction::Entity::find()
@ -232,6 +237,11 @@ impl Initializer {
}); });
tasks.push(handler); tasks.push(handler);
} }
if tasks.len() > 1000 {
future::join_all(tasks).await;
tasks = Vec::new()
}
} }
let mut votes = poll_vote::Entity::find() let mut votes = poll_vote::Entity::find()
@ -256,6 +266,11 @@ impl Initializer {
}); });
tasks.push(handler); tasks.push(handler);
} }
if tasks.len() > 1000 {
future::join_all(tasks).await;
tasks = Vec::new()
}
} }
let mut notifications = notification::Entity::find() let mut notifications = notification::Entity::find()
@ -279,9 +294,12 @@ impl Initializer {
}); });
tasks.push(handler); tasks.push(handler);
} }
}
future::join_all(tasks).await; if tasks.len() > 1000 {
future::join_all(tasks).await;
tasks = Vec::new()
}
}
Ok(()) Ok(())
} }