From 3bdf01bc1c11dea3b38f2ed3cac78aeb89402272 Mon Sep 17 00:00:00 2001 From: Cong Chen Date: Fri, 30 Jun 2023 17:39:23 +0800 Subject: [PATCH] Fix failed test --- index-scheduler/src/lib.rs | 10 +--------- meilisearch/src/routes/metrics.rs | 6 ++++-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/index-scheduler/src/lib.rs b/index-scheduler/src/lib.rs index 1f984e733..0594e15e0 100644 --- a/index-scheduler/src/lib.rs +++ b/index-scheduler/src/lib.rs @@ -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); } diff --git a/meilisearch/src/routes/metrics.rs b/meilisearch/src/routes/metrics.rs index f6ee3291b..d35778881 100644 --- a/meilisearch/src/routes/metrics.rs +++ b/meilisearch/src/routes/metrics.rs @@ -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![];