mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 11:57:07 +02:00
Send a basic progressing status to the updates front page
This commit is contained in:
parent
4eeeccb9cd
commit
f6eecb855e
7 changed files with 127 additions and 47 deletions
|
@ -230,26 +230,30 @@ fn csv_bytes_readers<'a>(
|
|||
readers
|
||||
}
|
||||
|
||||
pub fn run<'a>(
|
||||
pub fn run<'a, F>(
|
||||
env: &heed::Env,
|
||||
index: &Index,
|
||||
opt: &IndexerOpt,
|
||||
content: &'a [u8],
|
||||
gzipped: bool,
|
||||
progress_callback: F,
|
||||
) -> anyhow::Result<()>
|
||||
where F: Fn(u32) + Sync + Send,
|
||||
{
|
||||
let jobs = opt.indexing_jobs.unwrap_or(0);
|
||||
let pool = rayon::ThreadPoolBuilder::new().num_threads(jobs).build()?;
|
||||
pool.install(|| run_intern(env, index, opt, content, gzipped))
|
||||
pool.install(|| run_intern(env, index, opt, content, gzipped, progress_callback))
|
||||
}
|
||||
|
||||
fn run_intern<'a>(
|
||||
fn run_intern<'a, F>(
|
||||
env: &heed::Env,
|
||||
index: &Index,
|
||||
opt: &IndexerOpt,
|
||||
content: &'a [u8],
|
||||
gzipped: bool,
|
||||
progress_callback: F,
|
||||
) -> anyhow::Result<()>
|
||||
where F: Fn(u32) + Sync + Send,
|
||||
{
|
||||
let before_indexing = Instant::now();
|
||||
let num_threads = rayon::current_num_threads();
|
||||
|
@ -283,7 +287,7 @@ fn run_intern<'a>(
|
|||
chunk_fusing_shrink_size,
|
||||
)?;
|
||||
let base_document_id = number_of_documents;
|
||||
store.index_csv(rdr, base_document_id, i, num_threads, log_every_n)
|
||||
store.index_csv(rdr, base_document_id, i, num_threads, log_every_n, &progress_callback)
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue