Fix failed test

This commit is contained in:
Cong Chen 2023-06-30 17:39:23 +08:00
parent a5a31667b0
commit 3bdf01bc1c
2 changed files with 5 additions and 11 deletions

View File

@ -1817,17 +1817,9 @@ mod tests {
fn test_task_is_processing() {
let (index_scheduler, mut handle) = IndexScheduler::test(true, vec![]);
let (file0, documents_count0) = sample_documents(&index_scheduler, 0, 0);
file0.persist().unwrap();
let _ = index_scheduler
.register(replace_document_import_task("catto", None, 0, documents_count0))
.unwrap();
index_scheduler.register(index_creation_task("index_a", "id")).unwrap();
snapshot!(snapshot_index_scheduler(&index_scheduler), name: "registered_a_task");
handle.advance_till([Start, BatchCreated, InsideProcessBatch]);
snapshot!(snapshot_index_scheduler(&index_scheduler), name: "initial_task_processing");
assert_eq!(index_scheduler.is_task_processing().unwrap(), true);
}

View File

@ -48,8 +48,10 @@ pub async fn get_metrics(
}
}
crate::metrics::MEILISEARCH_LAST_UPDATE.set(response.last_update.unwrap().unix_timestamp() as i64);
crate::metrics::MEILISEARCH_IS_INDEXING.set(index_scheduler.is_task_processing().unwrap() as i64);
crate::metrics::MEILISEARCH_LAST_UPDATE
.set(response.last_update.unwrap().unix_timestamp());
crate::metrics::MEILISEARCH_IS_INDEXING
.set(index_scheduler.is_task_processing().unwrap() as i64);
let encoder = TextEncoder::new();
let mut buffer = vec![];