From a031e16693ca563748e64c4fbb3fe9526efdd4a5 Mon Sep 17 00:00:00 2001 From: iximeow Date: Thu, 29 Jun 2023 01:55:25 -0700 Subject: HACK: filter out old artifacts from commits with duplicate runs --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index eebe626..2cc9bbe 100644 --- a/src/main.rs +++ b/src/main.rs @@ -469,7 +469,11 @@ async fn handle_commit_status(Path(path): Path<(String, String, String)>, State( }; let mut artifacts_fragment = String::new(); - let mut artifacts = ctx.dbctx.artifacts_for_job(job.id, None).unwrap(); + let mut artifacts = ctx.dbctx.artifacts_for_job(job.id, None).unwrap() + .into_iter() // HACK: filter out artifacts for previous runs of a job. artifacts should be attached to a run, runs should be distinct from jobs. but i'm sleepy. + .filter(|artifact| artifact.created_time >= job.start_time.unwrap_or_else(crate::io::now_ms)) + .collect(); + artifacts.sort_by_key(|artifact| artifact.created_time); fn diff_times(job_completed: u64, artifact_completed: Option) -> u64 { -- cgit v1.1