aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2024-01-18 14:40:48 +0000
committerChristopher Baines <mail@cbaines.net>2024-01-18 14:41:32 +0000
commitb8bd56a8f5441bb45f0f3731987fda27ccd9674f (patch)
treeaf5eebaad5e8fec4c92fed11395a4c3368ef1a3f /guix-data-service
parent46b4c87e92a1470198e6c9c6cb1d7e3556f3a3a7 (diff)
downloaddata-service-b8bd56a8f5441bb45f0f3731987fda27ccd9674f.tar
data-service-b8bd56a8f5441bb45f0f3731987fda27ccd9674f.tar.gz
Fix par-map&
To actually work in parallel.
Diffstat (limited to 'guix-data-service')
-rw-r--r--guix-data-service/utils.scm22
1 files changed, 12 insertions, 10 deletions
diff --git a/guix-data-service/utils.scm b/guix-data-service/utils.scm
index 09f47f8..5d7d4ba 100644
--- a/guix-data-service/utils.scm
+++ b/guix-data-service/utils.scm
@@ -479,16 +479,18 @@ available. Return the resource once PROC has returned."
(define (par-mapper' mapper cons)
(lambda (proc . lists)
- (let loop ((lists lists))
- (match lists
- (((heads tails ...) ...)
- (let ((tail (loop tails))
- (head (defer-to-parallel-fiber
- (lambda ()
- (apply proc heads)))))
- (cons (fetch-result-of-defered-thunks head) tail)))
- (_
- '())))))
+ (apply
+ fetch-result-of-defered-thunks
+ (let loop ((lists lists))
+ (match lists
+ (((heads tails ...) ...)
+ (let ((tail (loop tails))
+ (head (defer-to-parallel-fiber
+ (lambda ()
+ (apply proc heads)))))
+ (cons head tail)))
+ (_
+ '()))))))
(define par-map& (par-mapper' map cons))