Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the multithreading bug in joinset #34

Merged
merged 1 commit into from
Oct 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/lava/logcloud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,13 +702,13 @@ pub async fn search_logcloud(
for (file_id, (kauai_size, reader_kauai)) in kauai_sizes.into_iter().zip(reader_kauais.into_iter()).enumerate() {
let query_clone = query.clone();
set.spawn(
async move { search_kauai(file_id, reader_kauai, kauai_size, query_clone, limit.try_into().unwrap()) },
async move { search_kauai(file_id, reader_kauai, kauai_size, query_clone, limit.try_into().unwrap()).await.unwrap() },
);
}

let mut all_uids: Vec<(usize, PlistSize)> = Vec::new();
while let Some(result) = set.join_next().await {
let result = result.unwrap().await.unwrap();
let result = result.unwrap();
match result.0 {
0 => {
println!("brute force");
Expand Down Expand Up @@ -751,12 +751,12 @@ pub async fn search_logcloud(
let hawaii_filename = hawaii_filenames.remove(0);
let query_clone = query.clone();
set.spawn(async move {
search_hawaii_oahu(file_id, hawaii_filename, reader_oahu, oahu_size, query_clone, new_limit)
search_hawaii_oahu(file_id, hawaii_filename, reader_oahu, oahu_size, query_clone, new_limit).await.unwrap()
});
}

while let Some(result) = set.join_next().await {
let result = result.unwrap().await.unwrap();
let result = result.unwrap();
all_uids.extend(result);
if all_uids.len() >= limit {
return Ok((1, all_uids));
Expand Down
Loading