From 45ae0869746219e7636c4ae896a51e014ad13464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Mon, 9 Nov 2020 17:33:07 +0100 Subject: [PATCH 1/3] Make sure pending updates are process when restarting the UpdateStore --- src/update/update_store.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/update/update_store.rs b/src/update/update_store.rs index 4723f0b68..de07f1e21 100644 --- a/src/update/update_store.rs +++ b/src/update/update_store.rs @@ -36,6 +36,9 @@ impl UpdateStore { let processed_meta = env.create_database(Some("processed-meta"))?; let (notification_sender, notification_receiver) = crossbeam_channel::bounded(1); + // Send a first notification to trigger the process. + let _ = notification_sender.send(()); + let update_store = Arc::new(UpdateStore { env, pending, From cf8a6a042e7c59793cc3cd1131584ed1c4724328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Mon, 9 Nov 2020 17:33:36 +0100 Subject: [PATCH 2/3] Display a real progress bar when updates are processed --- http-ui/public/updates-script.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/http-ui/public/updates-script.js b/http-ui/public/updates-script.js index 8005c554c..c034c45b8 100644 --- a/http-ui/public/updates-script.js +++ b/http-ui/public/updates-script.js @@ -52,7 +52,16 @@ $(window).on('load', function () { if (status.type == "Progressing") { const id = 'update-' + status.update_id; const content = $(`#${id} .updateStatus.content`); - content.html('progressing... ' + JSON.stringify(status.meta)); + + let html; + let { type, processed_number_of_documents, total_number_of_documents } = status.meta; + if (type === 'DocumentsAddition' && processed_number_of_documents && total_number_of_documents) { + let progress = Math.round(processed_number_of_documents / total_number_of_documents * 100); + html = ``; + } else { + html = ``; + } + content.html(html); } if (status.type == "Processed") { From 0cfeee13eef32e2d3567caca8194dd591a76d7ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Mon, 9 Nov 2020 17:34:52 +0100 Subject: [PATCH 3/3] Reduce the number of documents limit when update progress are sent --- http-ui/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http-ui/src/main.rs b/http-ui/src/main.rs index bfd326837..a72799770 100644 --- a/http-ui/src/main.rs +++ b/http-ui/src/main.rs @@ -69,7 +69,7 @@ pub struct Opt { pub struct IndexerOpt { /// The amount of documents to skip before printing /// a log regarding the indexing advancement. - #[structopt(long, default_value = "1000000")] // 1m + #[structopt(long, default_value = "100000")] // 100k pub log_every_n: usize, /// MTBL max number of chunks in bytes.