mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-05 08:10:39 +00:00
Fix timestamp skew in start_run and deduplicate ts() helper
Capture chrono::Utc::now() once in start_run so the stored ManagedRun and the StartRunResponse return the same created_at. Move the identical ts() timestamp-parsing helper from 4 demo submodules to the parent scope. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b2b25fbe6c
commit
d6ca768ddc
2 changed files with 15 additions and 23 deletions
|
|
@ -686,13 +686,15 @@ pub async fn get_aggregate_usage(
|
|||
|
||||
// ── Data modules ───────────────────────────────────────────────────────
|
||||
|
||||
mod runs {
|
||||
use arc_types::*;
|
||||
use chrono::{DateTime, Utc};
|
||||
use chrono::{DateTime, Utc};
|
||||
|
||||
fn ts(s: &str) -> DateTime<Utc> {
|
||||
s.parse().unwrap()
|
||||
}
|
||||
fn ts(s: &str) -> DateTime<Utc> {
|
||||
s.parse().unwrap()
|
||||
}
|
||||
|
||||
mod runs {
|
||||
use super::ts;
|
||||
use arc_types::*;
|
||||
|
||||
pub fn list_items() -> Vec<RunListItem> {
|
||||
vec![
|
||||
|
|
@ -2310,12 +2312,8 @@ mod verifications {
|
|||
}
|
||||
|
||||
mod retros {
|
||||
use super::ts;
|
||||
use arc_types::*;
|
||||
use chrono::{DateTime, Utc};
|
||||
|
||||
fn ts(s: &str) -> DateTime<Utc> {
|
||||
s.parse().unwrap()
|
||||
}
|
||||
|
||||
pub fn list_items() -> Vec<RetroListItem> {
|
||||
vec![
|
||||
|
|
@ -2431,14 +2429,10 @@ mod retros {
|
|||
}
|
||||
|
||||
mod sessions {
|
||||
use super::ts;
|
||||
use arc_types::*;
|
||||
use chrono::{DateTime, Utc};
|
||||
use uuid::Uuid;
|
||||
|
||||
fn ts(s: &str) -> DateTime<Utc> {
|
||||
s.parse().unwrap()
|
||||
}
|
||||
|
||||
fn uid(n: u128) -> Uuid {
|
||||
Uuid::from_u128(n)
|
||||
}
|
||||
|
|
@ -2577,12 +2571,8 @@ mod sessions {
|
|||
}
|
||||
|
||||
mod insights {
|
||||
use super::ts;
|
||||
use arc_types::*;
|
||||
use chrono::{DateTime, Utc};
|
||||
|
||||
fn ts(s: &str) -> DateTime<Utc> {
|
||||
s.parse().unwrap()
|
||||
}
|
||||
|
||||
pub fn saved_queries() -> Vec<SavedQuery> {
|
||||
vec![
|
||||
|
|
|
|||
|
|
@ -424,6 +424,8 @@ async fn start_run(
|
|||
let run_id = ulid::Ulid::new().to_string();
|
||||
info!(run_id = %run_id, "Run queued");
|
||||
|
||||
let created_at = chrono::Utc::now();
|
||||
|
||||
{
|
||||
let mut runs = state.runs.lock().expect("runs lock poisoned");
|
||||
runs.insert(
|
||||
|
|
@ -433,7 +435,7 @@ async fn start_run(
|
|||
graph,
|
||||
status: RunStatus::Queued,
|
||||
error: None,
|
||||
created_at: chrono::Utc::now(),
|
||||
created_at,
|
||||
interviewer: None,
|
||||
event_tx: None,
|
||||
context: None,
|
||||
|
|
@ -452,7 +454,7 @@ async fn start_run(
|
|||
Json(StartRunResponse {
|
||||
id: run_id,
|
||||
status: RunStatus::Queued,
|
||||
created_at: chrono::Utc::now(),
|
||||
created_at,
|
||||
}),
|
||||
)
|
||||
.into_response()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue