unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Christopher Baines <mail@cbaines.net>
To: 47158@debbugs.gnu.org
Subject: [bug#47158] [PATCH 1/2] substitutes: lookup-narinfos: Return the number of requests made.
Date: Mon, 15 Mar 2021 15:12:56 +0000	[thread overview]
Message-ID: <20210315151257.17384-1-mail@cbaines.net> (raw)
In-Reply-To: <877dm8fpdg.fsf@cbaines.net>

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 --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
-- 
2.30.1





  reply	other threads:[~2021-03-15 15:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-15 14:44 [bug#47158] [PATCH 0/2] scripts: weather: Provide more representative request statistics Christopher Baines
2021-03-15 15:12 ` Christopher Baines [this message]
2021-03-15 15:12   ` [bug#47158] [PATCH 2/2] " Christopher Baines
2021-03-17 10:56 ` [bug#47158] [PATCH 0/2] " Ludovic Courtès
2021-03-17 23:07   ` bug#47158: " Christopher Baines

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210315151257.17384-1-mail@cbaines.net \
    --to=mail@cbaines.net \
    --cc=47158@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).