Subject: bug#65787: time-machine is doing too much network requests

From: Simon Tournier <[email-masked]>
Date: Mon, 11 Sep 2023 13:36:40 +0200

Oops, missing diff for clarity. :-)

On Mon, 11 Sep 2023 at 11:41, Simon Tournier <[email-masked]> wrote:

> If yes, here two examples:

Adding ’pk’ where ’remote-fetch’ and ’branch-lookup’ are called.

diff --git a/guix/git.scm b/guix/git.scm
index 1cb87a45607b..0209826c5c00 100644
--- a/guix/git.scm
+++ b/guix/git.scm
@@ -234,8 +234,10 @@ (define (resolve-reference repository ref)
   (let resolve ((ref ref))
     (match ref
       (('branch . branch)
-       (let ((oid (reference-target
-                   (branch-lookup repository branch BRANCH-REMOTE))))
+       (let ((oid (begin
+                    (pk 'branch-lookup 'NETWORK)
+                    (reference-target
+                          (branch-lookup repository branch BRANCH-REMOTE)))))
          (object-lookup repository oid)))
       (('symref . symref)
        (let ((oid (reference-name->oid repository symref)))
@@ -483,8 +485,10 @@ (define* (update-cached-checkout url
      ;; Only fetch remote if it has not been cloned just before.
      (when (and cache-exists?
                 (not (reference-available? repository ref)))
-       (remote-fetch (remote-lookup repository "origin")
-                     #:fetch-options (make-default-fetch-options)))
+       (begin
+         (pk 'remote-fetch 'NETWORK)
+         (remote-fetch (remote-lookup repository "origin")
+                       #:fetch-options (make-default-fetch-options))))
      (when recursive?
        (update-submodules repository #:log-port log-port
                           #:fetch-options (make-default-fetch-options)))

Cheers,
simon