mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-23 05:00:06 +01:00
Hide the batch_uid field from the tasks route
This commit is contained in:
parent
22874ce300
commit
0c03ed3c1e
@ -4,7 +4,6 @@ use std::str::FromStr;
|
|||||||
use std::write;
|
use std::write;
|
||||||
|
|
||||||
use meilisearch_lib::index::{Settings, Unchecked};
|
use meilisearch_lib::index::{Settings, Unchecked};
|
||||||
use meilisearch_lib::tasks::batch::BatchId;
|
|
||||||
use meilisearch_lib::tasks::task::{
|
use meilisearch_lib::tasks::task::{
|
||||||
DocumentDeletion, Task, TaskContent, TaskEvent, TaskId, TaskResult,
|
DocumentDeletion, Task, TaskContent, TaskEvent, TaskId, TaskResult,
|
||||||
};
|
};
|
||||||
@ -12,8 +11,6 @@ use meilisearch_types::error::ResponseError;
|
|||||||
use serde::{Deserialize, Serialize, Serializer};
|
use serde::{Deserialize, Serialize, Serializer};
|
||||||
use time::{Duration, OffsetDateTime};
|
use time::{Duration, OffsetDateTime};
|
||||||
|
|
||||||
use crate::AUTOBATCHING_ENABLED;
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub enum TaskType {
|
pub enum TaskType {
|
||||||
@ -230,8 +227,6 @@ pub struct TaskView {
|
|||||||
started_at: Option<OffsetDateTime>,
|
started_at: Option<OffsetDateTime>,
|
||||||
#[serde(serialize_with = "time::serde::rfc3339::option::serialize")]
|
#[serde(serialize_with = "time::serde::rfc3339::option::serialize")]
|
||||||
finished_at: Option<OffsetDateTime>,
|
finished_at: Option<OffsetDateTime>,
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
batch_uid: Option<BatchId>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Task> for TaskView {
|
impl From<Task> for TaskView {
|
||||||
@ -380,16 +375,6 @@ impl From<Task> for TaskView {
|
|||||||
|
|
||||||
let duration = finished_at.zip(started_at).map(|(tf, ts)| (tf - ts));
|
let duration = finished_at.zip(started_at).map(|(tf, ts)| (tf - ts));
|
||||||
|
|
||||||
let batch_uid = AUTOBATCHING_ENABLED
|
|
||||||
.load(std::sync::atomic::Ordering::Relaxed)
|
|
||||||
.then(|| {
|
|
||||||
events.iter().find_map(|e| match e {
|
|
||||||
TaskEvent::Batched { batch_id, .. } => Some(*batch_id),
|
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.flatten();
|
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
uid: id,
|
uid: id,
|
||||||
index_uid,
|
index_uid,
|
||||||
@ -401,7 +386,6 @@ impl From<Task> for TaskView {
|
|||||||
enqueued_at,
|
enqueued_at,
|
||||||
started_at,
|
started_at,
|
||||||
finished_at,
|
finished_at,
|
||||||
batch_uid,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user