diff options
author | Christopher Baines <mail@cbaines.net> | 2024-05-15 13:08:12 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2024-05-15 14:33:23 +0100 |
commit | 612f5dfbc876c6f163099c08caac018d98bad357 (patch) | |
tree | ba48876f6fdb08069dd2e024305894aa4b0da110 /guix-qa-frontpage | |
parent | 3eaa40dfe2d6be4faef89801c938a9b9232f785d (diff) | |
download | qa-frontpage-612f5dfbc876c6f163099c08caac018d98bad357.tar qa-frontpage-612f5dfbc876c6f163099c08caac018d98bad357.tar.gz |
Add a way of controling the fibers for-each batch size
Diffstat (limited to 'guix-qa-frontpage')
-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)) |