aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-10-21 19:25:30 +0100
committerChristopher Baines <mail@cbaines.net>2020-10-21 19:25:30 +0100
commit41a7f38f44c10878e536135cbfabd4e37ca4fb21 (patch)
treeec09df42e2285905cba29a7032e5241cb2c15e70
parentb5b89b3645e0868aa225926cff66602626b7a145 (diff)
downloaddata-service-41a7f38f44c10878e536135cbfabd4e37ca4fb21.tar
data-service-41a7f38f44c10878e536135cbfabd4e37ca4fb21.tar.gz
Cleanup scheduled and started builds with "0" timestamps
Not sure how these appeared, but deleting them seems to be sensible.
-rw-r--r--guix-data-service/builds.scm16
1 files changed, 16 insertions, 0 deletions
diff --git a/guix-data-service/builds.scm b/guix-data-service/builds.scm
index e347789..7d681cc 100644
--- a/guix-data-service/builds.scm
+++ b/guix-data-service/builds.scm
@@ -123,12 +123,28 @@ initial connection on which HTTP requests are sent."
(_
(loop tail (+ 1 processed) result)))))))))) ;keep going
+(define (cleanup-bad-build-data conn)
+ (exec-query
+ conn
+ "
+DELETE FROM build_status
+WHERE status IN ('started', 'scheduled')
+ AND timestamp = '1970-01-01T00:00:00'
+ AND EXISTS (
+ SELECT 1
+ FROM build_status AS other
+ WHERE other.status = build_status.status
+ AND build_status.build_id = other.build_id
+ AND other.timestamp > '1970-01-01T00:00:01'
+ )"))
+
(define verbose-output?
(make-parameter #f))
(define* (query-build-servers conn build-server-ids revision-commits
outputs
#:key verbose?)
+ (cleanup-bad-build-data conn)
(parameterize
((verbose-output? verbose?))
(while #t