Ignore errors comming from crossbeam channel senders

This commit is contained in:
many 2021-08-26 11:01:30 +02:00
parent e09eec37bc
commit 8f702828ca
No known key found for this signature in database
GPG Key ID: 2CEF23B75189EACA
3 changed files with 19 additions and 19 deletions

View File

@ -147,9 +147,11 @@ fn spawn_extraction_task<FE, FS>(
Ok(chunks) => { Ok(chunks) => {
debug!("merge {} database", name); debug!("merge {} database", name);
let reader = merge_readers(chunks, merge_fn, indexer); 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) })?; 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<_>) = let (docid_word_positions_chunk, docid_fid_facet_values_chunks): (Result<_>, Result<_>) =
rayon::join( rayon::join(
@ -186,14 +188,14 @@ fn extract_documents_data(
)?; )?;
// send documents_ids to DB writer // 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 // send docid_word_positions_chunk to DB writer
let docid_word_positions_chunk = let docid_word_positions_chunk =
unsafe { into_clonable_grenad(docid_word_positions_chunk)? }; unsafe { into_clonable_grenad(docid_word_positions_chunk)? };
lmdb_writer_sx let _ = lmdb_writer_sx
.send(Ok(TypedChunk::DocidWordPositions(docid_word_positions_chunk.clone()))) .send(Ok(TypedChunk::DocidWordPositions(docid_word_positions_chunk.clone())));
.unwrap();
Ok(docid_word_positions_chunk) Ok(docid_word_positions_chunk)
}, },
|| { || {
@ -207,20 +209,18 @@ fn extract_documents_data(
// send docid_fid_facet_numbers_chunk to DB writer // send docid_fid_facet_numbers_chunk to DB writer
let docid_fid_facet_numbers_chunk = let docid_fid_facet_numbers_chunk =
unsafe { into_clonable_grenad(docid_fid_facet_numbers_chunk)? }; unsafe { into_clonable_grenad(docid_fid_facet_numbers_chunk)? };
lmdb_writer_sx
.send(Ok(TypedChunk::FieldIdDocidFacetNumbers( let _ = lmdb_writer_sx.send(Ok(TypedChunk::FieldIdDocidFacetNumbers(
docid_fid_facet_numbers_chunk.clone(), docid_fid_facet_numbers_chunk.clone(),
))) )));
.unwrap();
// send docid_fid_facet_strings_chunk to DB writer // send docid_fid_facet_strings_chunk to DB writer
let docid_fid_facet_strings_chunk = let docid_fid_facet_strings_chunk =
unsafe { into_clonable_grenad(docid_fid_facet_strings_chunk)? }; unsafe { into_clonable_grenad(docid_fid_facet_strings_chunk)? };
lmdb_writer_sx
.send(Ok(TypedChunk::FieldIdDocidFacetStrings( let _ = lmdb_writer_sx.send(Ok(TypedChunk::FieldIdDocidFacetStrings(
docid_fid_facet_strings_chunk.clone(), docid_fid_facet_strings_chunk.clone(),
))) )));
.unwrap();
Ok((docid_fid_facet_numbers_chunk, docid_fid_facet_strings_chunk)) Ok((docid_fid_facet_numbers_chunk, docid_fid_facet_strings_chunk))
}, },

View File

@ -268,7 +268,7 @@ impl<'t, 'u, 'i, 'a> IndexDocuments<'t, 'u, 'i, 'a> {
}); });
if let Err(e) = result { 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. // needs to be droped to avoid channel waiting lock.

View File

@ -95,7 +95,7 @@ pub(crate) fn write_typed_chunk_into_index(
// we use the key to construct the words fst. // we use the key to construct the words fst.
builder.insert(word)?; 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)?; let db_fst = index.words_fst(wtxn)?;
// merge new fst with database fst // merge new fst with database fst