From patchwork Mon Mar 15 15:12:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 27714 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id DC22D27BC54; Mon, 15 Mar 2021 15:14:15 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id AAEC227BC52 for ; Mon, 15 Mar 2021 15:14:15 +0000 (GMT) Received: from localhost ([::1]:37666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLov8-0000m5-T0 for patchwork@mira.cbaines.net; Mon, 15 Mar 2021 11:14:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLouw-0000kC-C1 for guix-patches@gnu.org; Mon, 15 Mar 2021 11:14:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:53059) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lLouw-0006fx-4F for guix-patches@gnu.org; Mon, 15 Mar 2021 11:14:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lLouw-0005ts-08 for guix-patches@gnu.org; Mon, 15 Mar 2021 11:14:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#47158] [PATCH 1/2] substitutes: lookup-narinfos: Return the number of requests made. References: <877dm8fpdg.fsf@cbaines.net> In-Reply-To: <877dm8fpdg.fsf@cbaines.net> Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 15 Mar 2021 15:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47158 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 47158@debbugs.gnu.org Received: via spool by 47158-submit@debbugs.gnu.org id=B47158.161582118322606 (code B ref 47158); Mon, 15 Mar 2021 15:14:01 +0000 Received: (at 47158) by debbugs.gnu.org; 15 Mar 2021 15:13:03 +0000 Received: from localhost ([127.0.0.1]:36372 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lLotz-0005sO-3g for submit@debbugs.gnu.org; Mon, 15 Mar 2021 11:13:03 -0400 Received: from mira.cbaines.net ([212.71.252.8]:60382) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lLotu-0005rc-Pj for 47158@debbugs.gnu.org; Mon, 15 Mar 2021 11:13:01 -0400 Received: from localhost (unknown [IPv6:2a02:8010:68c1:0:8ac0:b4c7:f5c8:7caa]) by mira.cbaines.net (Postfix) with ESMTPSA id E28EC27BC52 for <47158@debbugs.gnu.org>; Mon, 15 Mar 2021 15:12:57 +0000 (GMT) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id ee37dd7b for <47158@debbugs.gnu.org>; Mon, 15 Mar 2021 15:12:57 +0000 (UTC) From: Christopher Baines Date: Mon, 15 Mar 2021 15:12:56 +0000 Message-Id: <20210315151257.17384-1-mail@cbaines.net> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches 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