From c2ca259f481562103d638f63d58dab7452a3cf40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Tue, 4 Oct 2022 13:00:39 +0200 Subject: [PATCH] Update cli to latest `indicatif` crate version --- cli/src/main.rs | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/cli/src/main.rs b/cli/src/main.rs index e3bbced3e..a633e9fa7 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -3,7 +3,7 @@ use std::fs::File; use std::io::{stdin, BufRead, BufReader, Cursor, Read, Write}; use std::path::PathBuf; use std::str::FromStr; -use std::time::Instant; +use std::time::{Duration, Instant}; use byte_unit::Byte; use eyre::Result; @@ -267,10 +267,6 @@ impl Performer for DocumentAddition { return Err(error.into()); } - std::thread::spawn(move || { - progesses.join().unwrap(); - }); - let result = addition.execute()?; txn.commit()?; @@ -287,18 +283,19 @@ fn indexing_callback(step: milli::update::UpdateIndexingStep, bars: &[ProgressBa let prev = &bars[step_index - 1]; if !prev.is_finished() { prev.disable_steady_tick(); - prev.finish_at_current_pos(); + prev.finish(); } } let style = ProgressStyle::default_bar() + .progress_chars("##-") .template("[eta: {eta_precise}] {bar:40.cyan/blue} {pos:>7}/{len:7} {msg}") - .progress_chars("##-"); + .unwrap(); match step { RemapDocumentAddition { documents_seen } => { bar.set_style(ProgressStyle::default_spinner()); - bar.set_message(format!("remaped {} documents so far.", documents_seen)); + bar.set_message(format!("remapped {} documents so far.", documents_seen)); } ComputeIdsAndMergeDocuments { documents_seen, total_documents } => { bar.set_style(style); @@ -319,7 +316,7 @@ fn indexing_callback(step: milli::update::UpdateIndexingStep, bars: &[ProgressBa bar.set_position(databases_seen as u64); } } - bar.enable_steady_tick(200); + bar.enable_steady_tick(Duration::from_millis(200)); } fn documents_from_jsonl(reader: impl Read) -> Result> { @@ -520,10 +517,6 @@ impl Performer for SettingsUpdate { bars.push(bar); } - std::thread::spawn(move || { - progesses.join().unwrap(); - }); - update.execute(|step| indexing_callback(step, &bars))?; txn.commit()?;