Skip to content

Commit

Permalink
fix: first_event_at response
Browse files Browse the repository at this point in the history
  • Loading branch information
Eshanatnight committed Mar 27, 2024
1 parent 81b241d commit 83ffe27
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/src/handlers/http/logstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ pub async fn get_stats(req: HttpRequest) -> Result<impl Responder, StreamError>
)
}

// ? this case should not happen
None => {
let ingestion_stats = IngestionStats::new(
stats.events,
Expand All @@ -329,13 +328,14 @@ pub async fn get_stats(req: HttpRequest) -> Result<impl Responder, StreamError>
QueriedStats::new(
&stream_name,
&stream_meta.created_at,
Some('0'.to_string()),
None,
time,
ingestion_stats,
storage_stats,
)
}
};

let stats = if let Some(mut ingestor_stats) = ingestor_stats {
ingestor_stats.push(stats);
QueryServer::merge_quried_stats(ingestor_stats)
Expand Down
2 changes: 2 additions & 0 deletions server/src/handlers/http/modal/query_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,8 @@ impl QueryServer {
let min_first_event_at = stats
.iter()
.map(|x| match x.first_event_at.as_ref() {
// we can directly unwrap here because we are sure
// that the string is a valid date time or is None
Some(fea) => fea.parse::<DateTime<Utc>>().unwrap_or_default(),
None => Utc::now(),
})
Expand Down

0 comments on commit 83ffe27

Please sign in to comment.