mirror of
https://github.com/Syfaro/fuzzysearch.git
synced 2024-11-05 22:43:03 +00:00
Fix trying to load hashes before loop finished.
This commit is contained in:
parent
5dc771421c
commit
880c5f385e
@ -86,20 +86,17 @@ async fn main() {
|
||||
.expect("Unable to build http client");
|
||||
let client = std::sync::Arc::new(client);
|
||||
|
||||
let mut needed_posts = load_next_posts(pool.clone()).await;
|
||||
|
||||
loop {
|
||||
println!("running loop");
|
||||
|
||||
let needed_posts = load_next_posts(pool.clone()).await;
|
||||
|
||||
if needed_posts.is_empty() {
|
||||
println!("no posts, waiting a minute");
|
||||
tokio::time::delay_for(std::time::Duration::from_secs(60)).await;
|
||||
continue;
|
||||
}
|
||||
|
||||
let db = pool.clone();
|
||||
let posts_fut = tokio::spawn(async move { load_next_posts(db).await });
|
||||
|
||||
for chunk in needed_posts.chunks(8) {
|
||||
let futs = chunk.iter().map(|post| {
|
||||
let db = pool.clone();
|
||||
@ -136,7 +133,5 @@ async fn main() {
|
||||
|
||||
futures::future::join_all(futs).await;
|
||||
}
|
||||
|
||||
needed_posts = posts_fut.await.unwrap();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user