Make it possible to specify the batch size

In backfill-derivation-source-file-nars.
This commit is contained in:
Christopher Baines 2019-12-31 14:58:31 +00:00
parent f2343b5fc9
commit a6302a32ef

View file

@ -1066,7 +1066,7 @@ INSERT INTO derivation_source_file_nars (
(number->string uncompressed-size)
(string-append "\\x" data-string))))))
(define (backfill-derivation-source-file-nars conn)
(define* (backfill-derivation-source-file-nars conn #:key (batch-size 10000))
(define (missing-batch)
(exec-query
conn
@ -1076,7 +1076,8 @@ FROM derivation_source_files
WHERE id NOT IN (
SELECT derivation_source_file_id FROM derivation_source_file_nars
)
LIMIT 1000"))
LIMIT $1"
(list (number->string batch-size))))
(let loop ((batch (missing-batch)))
(unless (null? batch)