diff options
author | Christopher Baines <mail@cbaines.net> | 2023-05-05 17:59:29 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-05-05 17:59:29 +0100 |
commit | a534cfee45332f89a10e6a512073edfa25f727f5 (patch) | |
tree | 02364b45323e8cf3a53b23737a400b7bfab09623 /guix-build-coordinator | |
parent | fe26e18e72b9f6ddcb1f4d911f0d2c1a9125837a (diff) | |
download | build-coordinator-a534cfee45332f89a10e6a512073edfa25f727f5.tar build-coordinator-a534cfee45332f89a10e6a512073edfa25f727f5.tar.gz |
Use a hash table for build systems in the derivation ordered allocator
Like the basic allocator as this'll probably be faster.
Diffstat (limited to 'guix-build-coordinator')
-rw-r--r-- | guix-build-coordinator/build-allocator.scm | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/guix-build-coordinator/build-allocator.scm b/guix-build-coordinator/build-allocator.scm index f1d4a42..f7c7ef8 100644 --- a/guix-build-coordinator/build-allocator.scm +++ b/guix-build-coordinator/build-allocator.scm @@ -489,12 +489,16 @@ (datastore-fetch-prioritised-unprocessed-builds datastore))) (define systems-for-builds - (map (lambda (build-id) - (cons build-id - (datastore-find-build-derivation-system - datastore - build-id))) - prioritised-builds)) + ;; TODO Should be one query + (let ((table (make-hash-table))) + (for-each (lambda (build-id) + (hash-set! table + build-id + (datastore-find-build-derivation-system + datastore + build-id))) + prioritised-builds) + table)) (define tags-for-build (let ((build-tags (make-hash-table))) @@ -538,7 +542,7 @@ (log "build:" build-id) (and (or (null? requested-systems) - (let ((build-system (assoc-ref systems-for-builds build-id))) + (let ((build-system (hash-ref systems-for-builds build-id))) (member build-system requested-systems))) (agent-tags-match-build-tags agent-tags tags-for-build agent-id build-id) |