Check the WAL size for each chunk

Rather than for each system and target, as this should mean the
response (pausing and allowing inferiors and store connections to be closed)
is quicker.
This commit is contained in:
Christopher Baines 2024-08-09 15:47:49 +01:00
parent 371d76456f
commit 97b76000ec

View file

@ -1891,7 +1891,7 @@ SELECT 1 FROM derivation_source_file_nars WHERE derivation_source_file_id = $1"
(define chunk-size 5000) (define chunk-size 5000)
(define (process-system-and-target system target) (define (check-wal-size)
(let loop ((wal-bytes (let loop ((wal-bytes
(catch #t (catch #t
(lambda () (lambda ()
@ -1914,6 +1914,7 @@ SELECT 1 FROM derivation_source_file_nars WHERE derivation_source_file_id = $1"
(with-time-logging (with-time-logging
(simple-format #f "getting derivations for ~A" (cons system target)) (simple-format #f "getting derivations for ~A" (cons system target))
(let loop ((start-index 0)) (let loop ((start-index 0))
(check-wal-size)
(let* ((count (let* ((count
(if (>= (+ start-index chunk-size) packages-count) (if (>= (+ start-index chunk-size) packages-count)
(- packages-count start-index) (- packages-count start-index)