diff mbox series

[bug#47158,1/2] substitutes: lookup-narinfos: Return the number of requests made.

Message ID 20210315151257.17384-1-mail@cbaines.net
State Accepted
Headers show
Series [bug#47158,1/2] substitutes: lookup-narinfos: Return the number of requests made. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Christopher Baines March 15, 2021, 3:12 p.m. UTC
As an additional value, in addition to the narinfos.  This value is useful in
the weather script for reporting how many requests to the substitute server
were made.

* guix/substitutes.scm (lookup-narinfos): Additionally return the number of
requests made.
---
 guix/substitutes.scm | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/guix/substitutes.scm b/guix/substitutes.scm
index ef78013659..08f8c24efd 100644
--- a/guix/substitutes.scm
+++ b/guix/substitutes.scm
@@ -310,13 +310,14 @@  information is available locally."
                        '()
                        '()
                        paths)))
-    (if (null? missing)
-        cached
-        (let ((missing (fetch-narinfos cache missing
-                                       #:open-connection open-connection
-                                       #:make-progress-reporter
-                                       make-progress-reporter)))
-          (append cached (or missing '()))))))
+    (values (if (null? missing)
+                cached
+                (let ((missing (fetch-narinfos cache missing
+                                               #:open-connection open-connection
+                                               #:make-progress-reporter
+                                               make-progress-reporter)))
+                  (append cached (or missing '()))))
+            (length missing))))
 
 (define* (lookup-narinfos/diverse caches paths authorized?
                                   #:key (open-connection