summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-06-26 23:09:39 +0200
committerLudovic Courtès <ludo@gnu.org>2018-12-19 23:52:25 +0100
commit40cc850aebb497faed0a11d867d8fcee729023df (patch)
treefa69efaf602522fd1f8c27091ddbdbecebe10494
parent87b711d200ad13eaef284bdd1ab77f85618b0498 (diff)
downloadguix-40cc850aebb497faed0a11d867d8fcee729023df.tar.gz
download: 'built-in-builders*' relies on the functional cache.
The previous caching strategy, which used STORE as an 'eq?' key, would
no longer work when the functional cache is used because subsequent
store values are not 'eq?'.

* guix/download.scm (built-in-builders*): Rewrite in terms of
'mcached'.
-rw-r--r--guix/download.scm12
1 files changed, 3 insertions, 9 deletions
diff --git a/guix/download.scm b/guix/download.scm
index a7f51b1999..25eaefcffa 100644
--- a/guix/download.scm
+++ b/guix/download.scm
@@ -411,17 +411,11 @@
               (object->string %content-addressed-mirrors)))
 
 (define built-in-builders*
-  (let ((cache (make-weak-key-hash-table)))
+  (let ((proc (store-lift built-in-builders)))
     (lambda ()
       "Return, as a monadic value, the list of built-in builders supported by
-the daemon."
-      (lambda (store)
-        ;; Memoize the result to avoid repeated RPCs.
-        (values (or (hashq-ref cache store)
-                    (let ((result (built-in-builders store)))
-                      (hashq-set! cache store result)
-                      result))
-                store)))))
+the daemon; cache the return value."
+      (mcached (proc) built-in-builders))))
 
 (define* (built-in-download file-name url
                             #:key system hash-algo hash