diff options
author | Christopher Baines <mail@cbaines.net> | 2019-11-30 10:55:16 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-11-30 10:55:16 +0000 |
commit | 0aa78e9ef53e1d700b743ca396f1fe1cd597ff23 (patch) | |
tree | f3718550e574855adba80ad4d9f59a6ad1bb9b21 | |
parent | 0fa747e404b1baebf3c733a1554959e122c7ab25 (diff) | |
download | data-service-0aa78e9ef53e1d700b743ca396f1fe1cd597ff23.tar data-service-0aa78e9ef53e1d700b743ca396f1fe1cd597ff23.tar.gz |
Don't create misleading scheduled build status entries
Cuirass provides a timestamp field in build responses, and sometimes this
means when the build was scheduled, but when the build is finished, it's the
stoptime.
So only use the timestamp when the build hasn't finished.
-rw-r--r-- | guix-data-service/builds.scm | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/guix-data-service/builds.scm b/guix-data-service/builds.scm index 4ac42fb..e8b9d68 100644 --- a/guix-data-service/builds.scm +++ b/guix-data-service/builds.scm @@ -35,14 +35,16 @@ build-status-strings '("scheduled" "started"))) - (let ((status-string - (assq-ref build-statuses - (assoc-ref data "buildstatus"))) - (existing-status-entries - (map second - (select-build-statuses-by-build-id conn - build-id - build-server-id))) + (let* ((status-string + (assq-ref build-statuses + (assoc-ref data "buildstatus"))) + (finished? + (member status-string stop-statuses)) + (existing-status-entries + (map second + (select-build-statuses-by-build-id conn + build-id + build-server-id))) (timestamp (assoc-ref data "timestamp")) (starttime @@ -55,7 +57,12 @@ (filter list? (list - (unless (member "scheduled" existing-status-entries) + (when (and + ;; Cuirass returns the stoptime as the timestamp if the + ;; build has finished, so only use the timestamp if the + ;; build hasn't finished. + (not finished?) + (not (member "scheduled" existing-status-entries))) (list timestamp "scheduled")) (when (and (< 0 starttime) (not (member "started" existing-status-entries))) |