summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-05-24 10:51:34 +0200
committerLudovic Courtès <ludo@gnu.org>2017-05-24 11:17:42 +0200
commit737397355cfcf604c8f72fa1ef8c8e321221a6fb (patch)
treecfc560fd69523a39a78dc8c32765da20316b161c
parentae548434337cddf9677a4cd52b9370810b2cc9b6 (diff)
downloadguix-737397355cfcf604c8f72fa1ef8c8e321221a6fb.tar.gz
publish: Do not bake the same item several times.
Before this patch, there was a possibility that we'd queue several
baking tasks for the same item.  The first one would bake the item but
subsequent tasks wouldn't check whether the item had been baked in the
meantime and would re-bake it.

* guix/scripts/publish.scm (render-narinfo/cached): Don't call
'bake-narinfo+nar' when (file-exists? cached).
-rw-r--r--guix/scripts/publish.scm12
1 files changed, 7 insertions, 5 deletions
diff --git a/guix/scripts/publish.scm b/guix/scripts/publish.scm
index db7f6a957e..c306b809a7 100644
--- a/guix/scripts/publish.scm
+++ b/guix/scripts/publish.scm
@@ -425,11 +425,13 @@ requested using POOL."
            ;; return 404.
            (eventually pool
              (single-baker item
-               ;; (format #t "baking ~s~%" item)
-               (bake-narinfo+nar cache item
-                                 #:ttl ttl
-                                 #:compression compression
-                                 #:nar-path nar-path))
+               ;; Check whether CACHED has been produced in the meantime.
+               (unless (file-exists? cached)
+                 ;; (format #t "baking ~s~%" item)
+                 (bake-narinfo+nar cache item
+                                   #:ttl ttl
+                                   #:compression compression
+                                   #:nar-path nar-path)))
 
              (when ttl
                (single-baker 'cache-cleanup