guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: Ignore ENOENT in register-gc-roots.


From: Mathieu Othacehe
Subject: branch master updated: Ignore ENOENT in register-gc-roots.
Date: Mon, 06 Dec 2021 03:47:24 -0500

This is an automated email from the git hooks/post-receive script.

mothacehe pushed a commit to branch master
in repository guix-cuirass.

The following commit(s) were added to refs/heads/master by this push:
     new 6dcf2f6  Ignore ENOENT in register-gc-roots.
6dcf2f6 is described below

commit 6dcf2f65cea920b9b1c265de3e2b0abe0048a08e
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Mon Dec 6 09:44:56 2021 +0100

    Ignore ENOENT in register-gc-roots.
    
    * src/cuirass/base.scm (register-gc-roots): Ignore ENOENT exceptions.
    * src/cuirass/scripts/remote-server.scm (run-fetch): Adapt it.
    
    Suggested-by: Ludovic Courtès <ludo@gnu.org>
---
 src/cuirass/base.scm                  | 22 ++++++++++++++--------
 src/cuirass/scripts/remote-server.scm |  5 +----
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/src/cuirass/base.scm b/src/cuirass/base.scm
index 73d9a96..afe04d3 100644
--- a/src/cuirass/base.scm
+++ b/src/cuirass/base.scm
@@ -184,14 +184,20 @@ computed as its modification time + TTL seconds."
   "Register GC roots for the outputs of the given DRV when MODE is 'outputs or
 for DRV itself when MODE is 'derivation.  Also remove the expired GC roots if
 any."
-  (case mode
-    ((outputs)
-     (for-each (match-lambda
-                 ((name . output)
-                  (register-gc-root output)))
-               (derivation-path->output-paths drv)))
-    ((derivation)
-     (register-gc-root drv)))
+  (catch 'system-error
+    (lambda ()
+      (case mode
+        ((outputs)
+         (for-each (match-lambda
+                     ((name . output)
+                      (register-gc-root output)))
+                   (derivation-path->output-paths drv)))
+        ((derivation)
+         (register-gc-root drv))))
+    (lambda args
+      (unless (= ENOENT (system-error-errno args)) ;collected in the meantime
+        (apply throw args))))
+
   (maybe-remove-expired-cache-entries (%gc-root-directory)
                                       gc-roots
                                       #:entry-expiration
diff --git a/src/cuirass/scripts/remote-server.scm 
b/src/cuirass/scripts/remote-server.scm
index ece8ba3..4fd11ee 100644
--- a/src/cuirass/scripts/remote-server.scm
+++ b/src/cuirass/scripts/remote-server.scm
@@ -376,10 +376,7 @@ directory."
             (when (> duration 60)
               (log-message "fetching '~a' took ~a seconds."
                            drv duration)))))
-       ;; The derivation may have been GC'ed by that time. Do not try to
-       ;; register its outputs in that case.
-       (when (file-exists? drv)
-         (register-gc-roots drv))
+       (register-gc-roots drv)
 
        ;; Force the baking of the NAR substitutes so that the first client
        ;; doesn't receive a 404 error.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]