From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id GG1hBVPTuWDGQgEAgWs5BA (envelope-from ) for ; Fri, 04 Jun 2021 09:16:35 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 6MjuAFPTuWC4KAAAB5/wlQ (envelope-from ) for ; Fri, 04 Jun 2021 07:16:35 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9E722111A1 for ; Fri, 4 Jun 2021 09:16:34 +0200 (CEST) Received: from localhost ([::1]:58474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lp44H-0006Lw-Kl for larch@yhetil.org; Fri, 04 Jun 2021 03:16:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lp3rF-0004y2-4U for guix-patches@gnu.org; Fri, 04 Jun 2021 03:03:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33668) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lp3rC-0004vK-5F for guix-patches@gnu.org; Fri, 04 Jun 2021 03:03:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lp3rC-0005dz-2i for guix-patches@gnu.org; Fri, 04 Jun 2021 03:03:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48826] [PATCH] scripts: substitute: Cache connection when looking for narinfos. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 04 Jun 2021 07:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 48826 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48826@debbugs.gnu.org Cc: Mathieu Othacehe X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162279016121666 (code B ref -1); Fri, 04 Jun 2021 07:03:01 +0000 Received: (at submit) by debbugs.gnu.org; 4 Jun 2021 07:02:41 +0000 Received: from localhost ([127.0.0.1]:45214 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lp3qr-0005dO-9t for submit@debbugs.gnu.org; Fri, 04 Jun 2021 03:02:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:60138) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lp3qn-0005dD-5e for submit@debbugs.gnu.org; Fri, 04 Jun 2021 03:02:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lp3ql-0004lG-HQ for guix-patches@gnu.org; Fri, 04 Jun 2021 03:02:36 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:58462) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lp3ql-0004iC-0D for guix-patches@gnu.org; Fri, 04 Jun 2021 03:02:35 -0400 Received: from [2a01:e0a:19b:d9a0:f2f7:a404:c3d3:f8b4] (port=33836 helo=localhost.localdomain) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lp3qk-00051d-Ap; Fri, 04 Jun 2021 03:02:34 -0400 From: Mathieu Othacehe Date: Fri, 4 Jun 2021 09:02:23 +0200 Message-Id: <20210604070223.10680-1-othacehe@gnu.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1622790994; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=eXfxYKIHtGdbpmbG9m/zSgVAw7WaxK2EYoY8vIAxd/s=; b=t3COfKXTrq20n15H48eDNzoOy0LodOyKgIVhEEtEdxTUWyfKT7PR2fDKx5p85Pf+qNv4FF JsoTpa6i2fFuiA6aPPUaqkQrF2fctyuXPb+PG+keYyfQY4TfpqrpTQBxs2ijSgmvPmDuwx WnsuD4Z/MSid2wlfDYNwf90chQxsvH6Ho8w6XI/uRu4AyXbgxnQTZuLwOVJdUcfBA9JhYf BWa1YBMf2md34lLYA8QpEhKuliodJs8iK2fFwPMrC7kxRV2AdJr2CUMwUZP6EUWq51ZGoU tuzbS8MunkoT4F3LV/hElbgy3YEcksmmDKYzhP3uuGi0t/5xcb2OhdlrA8BRnA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1622790994; a=rsa-sha256; cv=none; b=F2FTLuA+Knd5ydEnguJdtAI758YU1XWtXAJWhWEOSdZhRPeFXqAIvIVbwayAm9u4jEQdnZ WQ7Fr7EmeCcCTUc45Bfmp4JUXZGMOkGxg+g39cdmg3kzXe+Dwow2hMvjis/vZURIJ9fvww WROoIA3k9uyS+9ip0VUHccjPU27LQ444PM0SGov7FZogohPyqWtw+23P48Epow+y+rl3or nhms/91EyjDhWcX8p6i+6D3tsF+QyRzadBCDU1At5CWECN8OG5V9Nfg6QmoDxOHTGEMk8X 49HqV0XXGJT9obKMEtkW8X0pGemPA7nzoEiGfVrsXzS25Hwo2840DoCxhgLltw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: 2.07 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 9E722111A1 X-Spam-Score: 2.07 X-Migadu-Scanner: scn0.migadu.com X-TUID: 8sz+TCTuCW1+ The process-substitution procedure is opening two distinct connections. The first one when looking for narinfo by calling lookup-narinfo and the other one when fetching nar files. Cache the connection when looking for narinfos so that process-substitution only opens one connection. * guix/scripts/substitute.scm (lookup-narinfo): Cache connection by using open-connection-for-uri/cached. --- guix/scripts/substitute.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm index 54311c3e08..44448ff3e9 100755 --- a/guix/scripts/substitute.scm +++ b/guix/scripts/substitute.scm @@ -163,7 +163,9 @@ if file doesn't exist, and the narinfo otherwise." (define (lookup-narinfo caches path authorized?) "Return the narinfo for PATH in CACHES, or #f when no substitute for PATH was found." - (match (lookup-narinfos/diverse caches (list path) authorized?) + (match (lookup-narinfos/diverse + caches (list path) authorized? + #:open-connection open-connection-for-uri/cached) ((answer) answer) (_ #f))) -- 2.31.1