mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-25 11:35:05 +08:00
improve the count of the number of tasks in a batch
This commit is contained in:
parent
71807cac6d
commit
1e694ae432
@ -61,9 +61,9 @@ impl ProcessingBatch {
|
|||||||
|
|
||||||
/// Update itself with the content of the task and update the batch id in the task.
|
/// Update itself with the content of the task and update the batch id in the task.
|
||||||
pub fn processing<'a>(&mut self, tasks: impl IntoIterator<Item = &'a mut Task>) {
|
pub fn processing<'a>(&mut self, tasks: impl IntoIterator<Item = &'a mut Task>) {
|
||||||
self.stats.total_nb_tasks += 1;
|
|
||||||
|
|
||||||
for task in tasks.into_iter() {
|
for task in tasks.into_iter() {
|
||||||
|
self.stats.total_nb_tasks += 1;
|
||||||
|
|
||||||
task.batch_uid = Some(self.uid);
|
task.batch_uid = Some(self.uid);
|
||||||
// We don't store the statuses in the map since they're all enqueued but we must
|
// We don't store the statuses in the map since they're all enqueued but we must
|
||||||
// still store them in the stats since that can be displayed.
|
// still store them in the stats since that can be displayed.
|
||||||
|
@ -46,7 +46,12 @@ async fn list_batches() {
|
|||||||
.await;
|
.await;
|
||||||
let (response, code) = index.list_batches().await;
|
let (response, code) = index.list_batches().await;
|
||||||
assert_eq!(code, 200);
|
assert_eq!(code, 200);
|
||||||
assert_eq!(response["results"].as_array().unwrap().len(), 2);
|
assert_eq!(
|
||||||
|
response["results"].as_array().unwrap().len(),
|
||||||
|
2,
|
||||||
|
"{}",
|
||||||
|
serde_json::to_string_pretty(&response).unwrap()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_rt::test]
|
#[actix_rt::test]
|
||||||
|
Loading…
Reference in New Issue
Block a user