diff options
author | Christopher Baines <mail@cbaines.net> | 2021-10-03 12:59:02 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2021-10-03 12:59:02 +0100 |
commit | 3627d36d770b4da4084a2d6175c24349c3b148cf (patch) | |
tree | b856bddb980c06f7a6c695dbf3a1cf45511dc9e5 | |
parent | 857b4e32d5761aac695348312d6753284d6e2175 (diff) | |
download | data-service-3627d36d770b4da4084a2d6175c24349c3b148cf.tar data-service-3627d36d770b4da4084a2d6175c24349c3b148cf.tar.gz |
Select existing derivations in chunks
To avoid one massive query.
-rw-r--r-- | guix-data-service/model/derivation.scm | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/guix-data-service/model/derivation.scm b/guix-data-service/model/derivation.scm index bc5431e..f2a5dfe 100644 --- a/guix-data-service/model/derivation.scm +++ b/guix-data-service/model/derivation.scm @@ -1707,12 +1707,15 @@ WHERE " criteria ";")) (unless (null? missing-file-names) (for-each - (match-lambda - ((id file-name) - (hash-set! derivation-ids-hash-table - file-name - (string->number id)))) - (exec-query conn (select-existing-derivations missing-file-names)))))) + (lambda (chunk) + (for-each + (match-lambda + ((id file-name) + (hash-set! derivation-ids-hash-table + file-name + (string->number id)))) + (exec-query conn (select-existing-derivations chunk)))) + (chunk! missing-file-names 2000))))) (define (derivation-file-names->derivation-ids conn derivation-file-names) (define (select-source-files-missing-nars derivation-ids) |