1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-05-23 01:25:57 +02:00

publish: Advertise a short TTL for "baking" 404s.

* guix/scripts/publish.scm (not-found): Add #:phrase and #:ttl
parameters and honor them.
* tests/publish.scm ("with cache"): Check the 'cache-control' header on
of the 404 response.
This commit is contained in:
Ludovic Courtès
2017-05-11 10:23:27 +02:00
parent 5899fafbfe
commit 24b21720f7
2 changed files with 18 additions and 4 deletions
+7
View File
@@ -355,6 +355,13 @@ FileSize: ~a~%"
(basename %item) ".nar"))
(response (http-get url)))
(and (= 404 (response-code response))
;; We should get an explicitly short TTL for 404 in this case
;; because it's going to become 200 shortly.
(match (assq-ref (response-headers response) 'cache-control)
((('max-age . ttl))
(< ttl 3600)))
(wait-for-file cached)
(let* ((body (http-get-port url))
(compressed (http-get nar-url))