From 037d12c9c9b8c96c09288297cacc7e20d88ea842 Mon Sep 17 00:00:00 2001 From: trinity Pointard Date: Mon, 6 Jan 2025 11:58:58 +0100 Subject: [PATCH] fix deadlocking on automaton warmup --- src/index/inverted_index_reader.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/index/inverted_index_reader.rs b/src/index/inverted_index_reader.rs index 4b9165ec49..3a960e795b 100644 --- a/src/index/inverted_index_reader.rs +++ b/src/index/inverted_index_reader.rs @@ -392,19 +392,17 @@ impl InvertedIndexReader { }; let task_handle = executor(Box::new(cpu_bound_task)); - let slices_downloaded = posting_ranges_to_load_stream + let posting_downloader = posting_ranges_to_load_stream .map(|posting_slice| { self.postings_file_slice .read_bytes_slice_async(posting_slice) .map(|result| result.map(|_slice| ())) }) .buffer_unordered(5) - .try_collect::>() - .await?; + .try_collect::>(); - // we don't need to pull that sooner, its future is only used to make sure we didn't miss - // an error, but the channel gets filled even before this is polled. - task_handle.await?; + let (_, slices_downloaded) = + futures_util::future::try_join(task_handle, posting_downloader).await?; Ok(!slices_downloaded.is_empty()) }