aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2022-11-12 11:42:33 +0000
committerChristopher Baines <mail@cbaines.net>2022-11-12 11:53:14 +0000
commitc46ee476325e018f43aa5d0c73b938cf726c9fce (patch)
treeb3a7bdd093857b3fc26d63577a41af0bf5a36a61
parented114265cdde01c71193f38d00e6fef8a6b1bebb (diff)
downloaddata-service-c46ee476325e018f43aa5d0c73b938cf726c9fce.tar
data-service-c46ee476325e018f43aa5d0c73b938cf726c9fce.tar.gz
Make backfilling blocked_builds a bit smarter
And drop the chunk size.
-rw-r--r--guix-data-service/model/blocked-builds.scm20
1 files changed, 18 insertions, 2 deletions
diff --git a/guix-data-service/model/blocked-builds.scm b/guix-data-service/model/blocked-builds.scm
index 480b554..1867f66 100644
--- a/guix-data-service/model/blocked-builds.scm
+++ b/guix-data-service/model/blocked-builds.scm
@@ -312,7 +312,23 @@ WHERE EXISTS (
"
SELECT build_id
FROM latest_build_status
- WHERE status IN ('failed', 'failed-dependency', 'failed-other', 'canceled')")
+INNER JOIN builds
+ ON latest_build_status.build_id = builds.id
+WHERE status IN ('failed', 'failed-dependency', 'failed-other', 'canceled')
+ AND NOT EXISTS (
+ SELECT 1
+ FROM builds AS other_builds
+ INNER JOIN latest_build_status AS other_latest_build_status
+ ON other_builds.id = other_latest_build_status.build_id
+ WHERE other_builds.derivation_output_details_set_id =
+ builds.derivation_output_details_set_id
+ AND other_latest_build_status.status IN ('succeeded', 'scheduled')
+ )
+ AND NOT EXISTS (
+ SELECT 1
+ FROM blocked_builds
+ WHERE blocking_derivation_output_details_set_id = builds.derivation_output_details_set_id
+ )")
(let ((build-ids
(map car (exec-query conn query '()))))
@@ -329,7 +345,7 @@ FROM latest_build_status
(handle-populating-blocked-builds-for-build-failures
conn
(map string->number ids))))))
- 500
+ 200
build-ids)))
(define* (select-blocking-builds conn revision-commit