summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-05-30 15:58:05 +0200
committerLudovic Courtès <ludo@gnu.org>2022-05-30 16:34:39 +0200
commit1ae0e1dc29109cef20dbe9d26eb1c855694716b5 (patch)
treeaccccbabb0b2996eaa50233939ddbdb1a39972d3
parent281bf7274529ae47f007a2b1eceacb5f25d12c0d (diff)
store: 'map/accumulate-builds' preserves caches.
Fixes <https://issues.guix.gnu.org/55721>. Starting from the switch to functional object caches ca. 9e5812ac59b01ff011ec0c5b0f437dfe85d6fcc7, we would be losing accumulated caches when aborting to the build handler. This patch fixes that. In particular, by preserving '%reference-cache-id', we avoid redundant 'query-references' RPCs, which accounted for a large part of the extra processing time. * guix/store.scm (build-accumulator): When returning an <unresolved> node, call 'set-store-connection-caches!' before and after to preserve caches. (map/accumulate-builds): Pass STORE as the first argument to the <unresolved> continuation.
-rw-r--r--guix/store.scm15
1 files changed, 13 insertions, 2 deletions
diff --git a/guix/store.scm b/guix/store.scm
index efba07bdcd..6bdd071b48 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -1337,7 +1337,17 @@ object, only for build requests on EXPECTED-STORE."
(if (and (eq? (store-connection-socket store)
(store-connection-socket expected-store))
(= mode (build-mode normal)))
- (unresolved things continue)
+ (begin
+ ;; Preserve caches accumulated up to this handler invocation.
+ (set-store-connection-caches! expected-store
+ (store-connection-caches store))
+
+ (unresolved things
+ (lambda (new-store value)
+ ;; Borrow caches from NEW-STORE.
+ (set-store-connection-caches!
+ store (store-connection-caches new-store))
+ (continue value))))
(continue #t))))
(define default-cutoff
@@ -1397,7 +1407,8 @@ CUTOFF is the threshold above which we stop accumulating unresolved nodes."
(if (unresolved? obj)
;; Pass #f because 'build-things' is now
;; unnecessary.
- ((unresolved-continuation obj) #f)
+ ((unresolved-continuation obj)
+ store #f)
obj))
result #:cutoff cutoff)
(map/accumulate-builds store proc rest #:cutoff cutoff)))))