diff options
-rw-r--r-- | guix-qa-frontpage/utils.scm | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/guix-qa-frontpage/utils.scm b/guix-qa-frontpage/utils.scm index abaed30..ba27c87 100644 --- a/guix-qa-frontpage/utils.scm +++ b/guix-qa-frontpage/utils.scm @@ -25,6 +25,7 @@ #:use-module (guix-build-coordinator utils fibers) #:export (fiberize fibers-map + fibers-batch-for-each fibers-for-each) #:re-export (with-fibers-port-timeouts)) @@ -95,7 +96,7 @@ (('exception . exn) (raise-exception exn))) (map get-message channels)))) -(define (fibers-for-each proc . lists) +(define (fibers-batch-for-each proc batch-size . lists) ;; Like split-at, but don't care about the order of the resulting lists, and ;; don't error if the list is shorter than i elements (define (split-at* lst i) @@ -106,7 +107,6 @@ ;; As this can be called with lists with tens of thousands of items in them, ;; batch the - (define batch-size 20) (define (get-batch lists) (let ((split-lists (map (lambda (lst) @@ -125,3 +125,6 @@ (unless (null? (car rest)) (loop rest))))) *unspecified*) + +(define (fibers-for-each proc . lists) + (apply fibers-batch-for-each proc 20 lists)) |