aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2021-10-03 12:59:02 +0100
committerChristopher Baines <mail@cbaines.net>2021-10-03 12:59:02 +0100
commit3627d36d770b4da4084a2d6175c24349c3b148cf (patch)
treeb856bddb980c06f7a6c695dbf3a1cf45511dc9e5
parent857b4e32d5761aac695348312d6753284d6e2175 (diff)
downloaddata-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.scm15
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)