diff options
-rw-r--r-- | guix-build-coordinator/build-allocator.scm | 33 | ||||
-rw-r--r-- | guix-build-coordinator/datastore/sqlite.scm | 38 |
2 files changed, 46 insertions, 25 deletions
diff --git a/guix-build-coordinator/build-allocator.scm b/guix-build-coordinator/build-allocator.scm index 2bd69a6..81b857c 100644 --- a/guix-build-coordinator/build-allocator.scm +++ b/guix-build-coordinator/build-allocator.scm @@ -21,6 +21,7 @@ (define-module (guix-build-coordinator build-allocator) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) + #:use-module (srfi srfi-43) #:use-module (ice-9 match) #:use-module (prometheus) #:use-module (guix memoization) @@ -152,10 +153,18 @@ (let ((build-tags (tags-for-build build-id))) (every (match-lambda ((agent-key . agent-value) - (match (assoc-ref build-tags agent-key) - ((_ . build-value) - (string=? agent-value build-value)) - (#f #t)))) + (any + (match-lambda + ((_ . build-value) + (string=? agent-value build-value))) + (vector-fold + (lambda (tag result) + (if (string=? (car tag) + agent-key) + (cons tag result) + result)) + '() + build-tags)))) agent-tags))))) (lambda (build) @@ -527,10 +536,18 @@ (let ((build-tags (tags-for-build build-id))) (every (match-lambda ((agent-key . agent-value) - (match (assoc-ref build-tags agent-key) - ((_ . build-value) - (string=? agent-value build-value)) - (#f #t)))) + (any + (match-lambda + ((_ . build-value) + (string=? agent-value build-value))) + (vector-fold + (lambda (tag result) + (if (string=? (car tag) + agent-key) + (cons tag result) + result)) + '() + build-tags)))) agent-tags))))) (lambda (build-id) diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm index ecd6097..6af0b46 100644 --- a/guix-build-coordinator/datastore/sqlite.scm +++ b/guix-build-coordinator/datastore/sqlite.scm @@ -399,14 +399,15 @@ WHERE agent_tags.agent_id = :agent_id" #:agent_id agent-id) (let ((result - (sqlite-fold - (lambda (row result) - (match row - (#(key value) - `((,key . ,value) - ,@result)))) - '() - statement))) + (list->vector + (sqlite-fold + (lambda (row result) + (match row + (#(key value) + `((,key . ,value) + ,@result)))) + '() + statement)))) (sqlite-reset statement) result))))) @@ -760,7 +761,9 @@ INSERT INTO build_tags (build_id, tag_id) VALUES (:build_id, :tag_id)" #:tag_id (tag->id key value)) (sqlite-step build-tags-statement) (sqlite-reset build-tags-statement))) - tags)))) + (if (vector? tags) + (vector->list tags) + tags))))) #t) (define-method (datastore-cancel-build @@ -1457,14 +1460,15 @@ WHERE build_tags.build_id = :build_id" #:build_id build-id) (let ((result - (sqlite-fold - (lambda (row result) - (match row - (#(key value) - `((,key . ,value) - ,@result)))) - '() - statement))) + (list->vector + (sqlite-fold + (lambda (row result) + (match row + (#(key value) + `((,key . ,value) + ,@result)))) + '() + statement)))) (sqlite-reset statement) result))))) |