Merge pull request #31 from meilisearch/improve-update-process

Improve update process
This commit is contained in:
Clément Renault 2020-11-09 17:45:19 +01:00 committed by GitHub
commit c00fc6f8bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View File

@ -52,7 +52,16 @@ $(window).on('load', function () {
if (status.type == "Progressing") { if (status.type == "Progressing") {
const id = 'update-' + status.update_id; const id = 'update-' + status.update_id;
const content = $(`#${id} .updateStatus.content`); 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 = `<progress class="progress" title="${progress}%" value="${progress}" max="100"></progress>`;
} else {
html = `<progress class="progress" max="100"></progress>`;
}
content.html(html);
} }
if (status.type == "Processed") { if (status.type == "Processed") {

View File

@ -69,7 +69,7 @@ pub struct Opt {
pub struct IndexerOpt { pub struct IndexerOpt {
/// The amount of documents to skip before printing /// The amount of documents to skip before printing
/// a log regarding the indexing advancement. /// a log regarding the indexing advancement.
#[structopt(long, default_value = "1000000")] // 1m #[structopt(long, default_value = "100000")] // 100k
pub log_every_n: usize, pub log_every_n: usize,
/// MTBL max number of chunks in bytes. /// MTBL max number of chunks in bytes.

View File

@ -36,6 +36,9 @@ impl<M: 'static, N: 'static> UpdateStore<M, N> {
let processed_meta = env.create_database(Some("processed-meta"))?; let processed_meta = env.create_database(Some("processed-meta"))?;
let (notification_sender, notification_receiver) = crossbeam_channel::bounded(1); 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 { let update_store = Arc::new(UpdateStore {
env, env,
pending, pending,