Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialize journal time stamp as number (not as a datetime string) #748

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/hyperqueue/src/server/event/log/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ mod tests {

let mut reader = EventLogReader::open(&path).unwrap();
let event = (&mut reader).next().unwrap().unwrap();
assert_eq!(event.time, time);
assert_eq!(event.time.timestamp_millis(), time.timestamp_millis());
assert!(matches!(
event.payload,
EventPayload::AllocationFinished(0, _)
Expand Down
2 changes: 2 additions & 0 deletions crates/hyperqueue/src/server/event/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pub mod payload;
pub mod streamer;

use bincode::Options;
use chrono::serde::ts_milliseconds;
use chrono::{DateTime, Utc};
use payload::EventPayload;
use serde::{Deserialize, Serialize};
Expand All @@ -11,6 +12,7 @@ pub type EventId = u32;

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Event {
#[serde(with = "ts_milliseconds")]
pub time: DateTime<Utc>,
pub payload: EventPayload,
}
Expand Down
Loading