From 4eefc28cd3194ae8d607ba939d4b9735bb4bda61 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 11 Nov 2023 17:39:46 +0000 Subject: Remove some caching from reading derivations As I'm not sure this is helpful. --- guix-build-coordinator/utils.scm | 45 +++++++++++++++------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/guix-build-coordinator/utils.scm b/guix-build-coordinator/utils.scm index 69cd743..dd27012 100644 --- a/guix-build-coordinator/utils.scm +++ b/guix-build-coordinator/utils.scm @@ -482,9 +482,6 @@ context." (hash-set! %derivation-cache file drv) drv))))) -(define %derivation-cache - (make-doubly-weak-hash-table)) - (define (read-derivation-through-substitutes derivation-name substitute-urls) (define %fetch-timeout @@ -571,31 +568,23 @@ context." #f)) (error "could not fetch narinfo")))) - (with-store/non-blocking store - (define (read-derivation-from-file/custom derivation-name) - (or (hash-ref %derivation-cache derivation-name) - - ;; Try the local store - (and (file-exists? derivation-name) - (valid-path? store derivation-name) - (read-derivation-from-file* derivation-name)) - - ;; Otherwise try the network - (let ((drv - (call-with-input-bytevector - (derivation-name->bytevector derivation-name) - (lambda (port) - (set-port-filename! port derivation-name) - (read-derivation port - read-derivation-from-file/custom))))) - - (hash-set! %derivation-cache - derivation-name - drv) - - drv))) - - (read-derivation-from-file/custom derivation-name))) + (define (read-derivation-from-file/custom derivation-name) + ;; Try the local store + (or (and (file-exists? derivation-name) + (with-store/non-blocking + store + (valid-path? store derivation-name)) + (read-derivation-from-file* derivation-name)) + + ;; Otherwise try the network + (call-with-input-bytevector + (derivation-name->bytevector derivation-name) + (lambda (port) + (set-port-filename! port derivation-name) + (read-derivation port + read-derivation-from-file/custom))))) + + (read-derivation-from-file/custom derivation-name)) (define* (narinfo-string store-path hash size references compressed-files -- cgit v1.2.3