diff options
author | iximeow <me@iximeow.net> | 2023-06-29 01:55:25 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2023-06-29 01:55:25 -0700 |
commit | a031e16693ca563748e64c4fbb3fe9526efdd4a5 (patch) | |
tree | d837fc2aca3760e8db75d13f2e87503bb6e9dc28 | |
parent | 69d2943e8c97c266ebcbb3e850f0a2493f6b04b4 (diff) |
HACK: filter out old artifacts from commits with duplicate runs
-rw-r--r-- | src/main.rs | 6 |
1 files changed, 5 insertions, 1 deletions
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>) -> u64 { |