From 8f702828ca23bed257def6d452705e707e5c3e1c Mon Sep 17 00:00:00 2001 From: many Date: Thu, 26 Aug 2021 11:01:30 +0200 Subject: [PATCH] Ignore errors comming from crossbeam channel senders --- .../src/update/index_documents/extract/mod.rs | 34 +++++++++---------- milli/src/update/index_documents/mod.rs | 2 +- .../src/update/index_documents/typed_chunk.rs | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/milli/src/update/index_documents/extract/mod.rs b/milli/src/update/index_documents/extract/mod.rs index 591c8d4cd..04c57b0fa 100644 --- a/milli/src/update/index_documents/extract/mod.rs +++ b/milli/src/update/index_documents/extract/mod.rs @@ -147,9 +147,11 @@ fn spawn_extraction_task( Ok(chunks) => { debug!("merge {} database", name); let reader = merge_readers(chunks, merge_fn, indexer); - lmdb_writer_sx.send(reader.map(|r| serialize_fn(r))).unwrap(); + let _ = lmdb_writer_sx.send(reader.map(|r| serialize_fn(r))); + } + Err(e) => { + let _ = lmdb_writer_sx.send(Err(e)); } - Err(e) => lmdb_writer_sx.send(Err(e)).unwrap(), }) }); } @@ -173,7 +175,7 @@ fn extract_documents_data( )> { let documents_chunk = documents_chunk.and_then(|c| unsafe { into_clonable_grenad(c) })?; - lmdb_writer_sx.send(Ok(TypedChunk::Documents(documents_chunk.clone()))).unwrap(); + let _ = lmdb_writer_sx.send(Ok(TypedChunk::Documents(documents_chunk.clone()))); let (docid_word_positions_chunk, docid_fid_facet_values_chunks): (Result<_>, Result<_>) = rayon::join( @@ -186,14 +188,14 @@ fn extract_documents_data( )?; // send documents_ids to DB writer - lmdb_writer_sx.send(Ok(TypedChunk::NewDocumentsIds(documents_ids))).unwrap(); + let _ = lmdb_writer_sx.send(Ok(TypedChunk::NewDocumentsIds(documents_ids))); // send docid_word_positions_chunk to DB writer let docid_word_positions_chunk = unsafe { into_clonable_grenad(docid_word_positions_chunk)? }; - lmdb_writer_sx - .send(Ok(TypedChunk::DocidWordPositions(docid_word_positions_chunk.clone()))) - .unwrap(); + let _ = lmdb_writer_sx + .send(Ok(TypedChunk::DocidWordPositions(docid_word_positions_chunk.clone()))); + Ok(docid_word_positions_chunk) }, || { @@ -207,20 +209,18 @@ fn extract_documents_data( // send docid_fid_facet_numbers_chunk to DB writer let docid_fid_facet_numbers_chunk = unsafe { into_clonable_grenad(docid_fid_facet_numbers_chunk)? }; - lmdb_writer_sx - .send(Ok(TypedChunk::FieldIdDocidFacetNumbers( - docid_fid_facet_numbers_chunk.clone(), - ))) - .unwrap(); + + let _ = lmdb_writer_sx.send(Ok(TypedChunk::FieldIdDocidFacetNumbers( + docid_fid_facet_numbers_chunk.clone(), + ))); // send docid_fid_facet_strings_chunk to DB writer let docid_fid_facet_strings_chunk = unsafe { into_clonable_grenad(docid_fid_facet_strings_chunk)? }; - lmdb_writer_sx - .send(Ok(TypedChunk::FieldIdDocidFacetStrings( - docid_fid_facet_strings_chunk.clone(), - ))) - .unwrap(); + + let _ = lmdb_writer_sx.send(Ok(TypedChunk::FieldIdDocidFacetStrings( + docid_fid_facet_strings_chunk.clone(), + ))); Ok((docid_fid_facet_numbers_chunk, docid_fid_facet_strings_chunk)) }, diff --git a/milli/src/update/index_documents/mod.rs b/milli/src/update/index_documents/mod.rs index d6fbd3e93..98b0aa80e 100644 --- a/milli/src/update/index_documents/mod.rs +++ b/milli/src/update/index_documents/mod.rs @@ -268,7 +268,7 @@ impl<'t, 'u, 'i, 'a> IndexDocuments<'t, 'u, 'i, 'a> { }); if let Err(e) = result { - lmdb_writer_sx.send(Err(e)).unwrap(); + let _ = lmdb_writer_sx.send(Err(e)); } // needs to be droped to avoid channel waiting lock. diff --git a/milli/src/update/index_documents/typed_chunk.rs b/milli/src/update/index_documents/typed_chunk.rs index e8790af16..84333addb 100644 --- a/milli/src/update/index_documents/typed_chunk.rs +++ b/milli/src/update/index_documents/typed_chunk.rs @@ -95,7 +95,7 @@ pub(crate) fn write_typed_chunk_into_index( // we use the key to construct the words fst. builder.insert(word)?; } - let fst = builder.into_set().map_data(std::borrow::Cow::Owned).unwrap(); + let fst = builder.into_set().map_data(std::borrow::Cow::Owned)?; let db_fst = index.words_fst(wtxn)?; // merge new fst with database fst