mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 03:55:07 +08:00
Merge #2200
2200: Fix(dumps): Explicitly define serde for time r=ManyTheFish a=ManyTheFish fix #2199 Co-authored-by: ManyTheFish <many@meilisearch.com>
This commit is contained in:
commit
81fe65afed
@ -54,9 +54,9 @@ pub struct ProcessedUpdateResult {
|
|||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
pub update_type: UpdateType,
|
pub update_type: UpdateType,
|
||||||
pub duration: f64, // in seconds
|
pub duration: f64, // in seconds
|
||||||
#[serde(serialize_with = "time::serde::rfc3339::serialize")]
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
pub enqueued_at: OffsetDateTime,
|
pub enqueued_at: OffsetDateTime,
|
||||||
#[serde(serialize_with = "time::serde::rfc3339::serialize")]
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
pub processed_at: OffsetDateTime,
|
pub processed_at: OffsetDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,9 +68,9 @@ pub struct FailedUpdateResult {
|
|||||||
pub update_type: UpdateType,
|
pub update_type: UpdateType,
|
||||||
pub error: ResponseError,
|
pub error: ResponseError,
|
||||||
pub duration: f64, // in seconds
|
pub duration: f64, // in seconds
|
||||||
#[serde(serialize_with = "time::serde::rfc3339::serialize")]
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
pub enqueued_at: OffsetDateTime,
|
pub enqueued_at: OffsetDateTime,
|
||||||
#[serde(serialize_with = "time::serde::rfc3339::serialize")]
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
pub processed_at: OffsetDateTime,
|
pub processed_at: OffsetDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,11 +80,11 @@ pub struct EnqueuedUpdateResult {
|
|||||||
pub update_id: u64,
|
pub update_id: u64,
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
pub update_type: UpdateType,
|
pub update_type: UpdateType,
|
||||||
#[serde(serialize_with = "time::serde::rfc3339::serialize")]
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
pub enqueued_at: OffsetDateTime,
|
pub enqueued_at: OffsetDateTime,
|
||||||
#[serde(
|
#[serde(
|
||||||
skip_serializing_if = "Option::is_none",
|
skip_serializing_if = "Option::is_none",
|
||||||
serialize_with = "time::serde::rfc3339::option::serialize"
|
with = "time::serde::rfc3339::option"
|
||||||
)]
|
)]
|
||||||
pub started_processing_at: Option<OffsetDateTime>,
|
pub started_processing_at: Option<OffsetDateTime>,
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,7 @@ pub enum UpdateMeta {
|
|||||||
pub struct Enqueued {
|
pub struct Enqueued {
|
||||||
pub update_id: u64,
|
pub update_id: u64,
|
||||||
pub meta: UpdateMeta,
|
pub meta: UpdateMeta,
|
||||||
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
pub enqueued_at: OffsetDateTime,
|
pub enqueued_at: OffsetDateTime,
|
||||||
pub content: Option<Uuid>,
|
pub content: Option<Uuid>,
|
||||||
}
|
}
|
||||||
@ -59,6 +60,7 @@ pub struct Enqueued {
|
|||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Processed {
|
pub struct Processed {
|
||||||
pub success: UpdateResult,
|
pub success: UpdateResult,
|
||||||
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
pub processed_at: OffsetDateTime,
|
pub processed_at: OffsetDateTime,
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub from: Processing,
|
pub from: Processing,
|
||||||
@ -69,6 +71,7 @@ pub struct Processed {
|
|||||||
pub struct Processing {
|
pub struct Processing {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub from: Enqueued,
|
pub from: Enqueued,
|
||||||
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
pub started_processing_at: OffsetDateTime,
|
pub started_processing_at: OffsetDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,6 +80,7 @@ pub struct Processing {
|
|||||||
pub struct Aborted {
|
pub struct Aborted {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub from: Enqueued,
|
pub from: Enqueued,
|
||||||
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
pub aborted_at: OffsetDateTime,
|
pub aborted_at: OffsetDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,6 +90,7 @@ pub struct Failed {
|
|||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub from: Processing,
|
pub from: Processing,
|
||||||
pub error: ResponseError,
|
pub error: ResponseError,
|
||||||
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
pub failed_at: OffsetDateTime,
|
pub failed_at: OffsetDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,6 +107,7 @@ pub enum UpdateMeta {
|
|||||||
pub struct Enqueued {
|
pub struct Enqueued {
|
||||||
pub update_id: u64,
|
pub update_id: u64,
|
||||||
pub meta: Update,
|
pub meta: Update,
|
||||||
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
pub enqueued_at: OffsetDateTime,
|
pub enqueued_at: OffsetDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,6 +123,7 @@ impl Enqueued {
|
|||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Processed {
|
pub struct Processed {
|
||||||
pub success: v2::UpdateResult,
|
pub success: v2::UpdateResult,
|
||||||
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
pub processed_at: OffsetDateTime,
|
pub processed_at: OffsetDateTime,
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub from: Processing,
|
pub from: Processing,
|
||||||
@ -144,6 +146,7 @@ impl Processed {
|
|||||||
pub struct Processing {
|
pub struct Processing {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub from: Enqueued,
|
pub from: Enqueued,
|
||||||
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
pub started_processing_at: OffsetDateTime,
|
pub started_processing_at: OffsetDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,6 +166,7 @@ pub struct Failed {
|
|||||||
pub from: Processing,
|
pub from: Processing,
|
||||||
pub msg: String,
|
pub msg: String,
|
||||||
pub code: Code,
|
pub code: Code,
|
||||||
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
pub failed_at: OffsetDateTime,
|
pub failed_at: OffsetDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ pub struct Metadata {
|
|||||||
db_version: String,
|
db_version: String,
|
||||||
index_db_size: usize,
|
index_db_size: usize,
|
||||||
update_db_size: usize,
|
update_db_size: usize,
|
||||||
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
dump_date: OffsetDateTime,
|
dump_date: OffsetDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,21 +36,32 @@ impl From<DocumentAdditionResult> for TaskResult {
|
|||||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||||
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
|
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
|
||||||
pub enum TaskEvent {
|
pub enum TaskEvent {
|
||||||
Created(#[cfg_attr(test, proptest(strategy = "test::datetime_strategy()"))] OffsetDateTime),
|
Created(
|
||||||
|
#[cfg_attr(test, proptest(strategy = "test::datetime_strategy()"))]
|
||||||
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
|
OffsetDateTime,
|
||||||
|
),
|
||||||
Batched {
|
Batched {
|
||||||
#[cfg_attr(test, proptest(strategy = "test::datetime_strategy()"))]
|
#[cfg_attr(test, proptest(strategy = "test::datetime_strategy()"))]
|
||||||
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
timestamp: OffsetDateTime,
|
timestamp: OffsetDateTime,
|
||||||
batch_id: BatchId,
|
batch_id: BatchId,
|
||||||
},
|
},
|
||||||
Processing(#[cfg_attr(test, proptest(strategy = "test::datetime_strategy()"))] OffsetDateTime),
|
Processing(
|
||||||
|
#[cfg_attr(test, proptest(strategy = "test::datetime_strategy()"))]
|
||||||
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
|
OffsetDateTime,
|
||||||
|
),
|
||||||
Succeded {
|
Succeded {
|
||||||
result: TaskResult,
|
result: TaskResult,
|
||||||
#[cfg_attr(test, proptest(strategy = "test::datetime_strategy()"))]
|
#[cfg_attr(test, proptest(strategy = "test::datetime_strategy()"))]
|
||||||
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
timestamp: OffsetDateTime,
|
timestamp: OffsetDateTime,
|
||||||
},
|
},
|
||||||
Failed {
|
Failed {
|
||||||
error: ResponseError,
|
error: ResponseError,
|
||||||
#[cfg_attr(test, proptest(strategy = "test::datetime_strategy()"))]
|
#[cfg_attr(test, proptest(strategy = "test::datetime_strategy()"))]
|
||||||
|
#[serde(with = "time::serde::rfc3339")]
|
||||||
timestamp: OffsetDateTime,
|
timestamp: OffsetDateTime,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user