[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/17: substitute: Delete cached narinfos more than two-month old.
From: |
guix-commits |
Subject: |
02/17: substitute: Delete cached narinfos more than two-month old. |
Date: |
Thu, 8 Jun 2023 17:46:52 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 3f5e14182931f123c10513a3e1e2abaebfb52279
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Wed May 31 23:02:16 2023 +0200
substitute: Delete cached narinfos more than two-month old.
This allows 'guix substitute' to shrink the cache a bit more, which
saves space and improves performance of cache-cleanup phases since fewer
entries need to be traversed.
* guix/scripts/substitute.scm (cached-narinfo-expiration-time): Define
'max-ttl' and use it as an upper bound.
---
guix/scripts/substitute.scm | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index 3626832dda..de7b77b0bf 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -167,6 +167,11 @@ was found."
(define (cached-narinfo-expiration-time file)
"Return the expiration time for FILE, which is a cached narinfo."
+ (define max-ttl
+ ;; Upper bound on the TTL used to avoid keeping around cached narinfos for
+ ;; too long, which makes the cache bigger and more expensive to traverse.
+ (* 2 30 24 60 60)) ;2 months
+
(catch 'system-error
(lambda ()
(call-with-input-file file
@@ -174,10 +179,10 @@ was found."
(match (read port)
(('narinfo ('version 2) ('cache-uri uri)
('date date) ('ttl ttl) ('value #f))
- (+ date ttl))
+ (+ date (min ttl max-ttl)))
(('narinfo ('version 2) ('cache-uri uri)
('date date) ('ttl ttl) ('value value))
- (+ date ttl))
+ (+ date (min ttl max-ttl)))
(x
0)))))
(lambda args
- branch master updated (872b248745 -> 22e7ba67dd), guix-commits, 2023/06/08
- 02/17: substitute: Delete cached narinfos more than two-month old.,
guix-commits <=
- 01/17: import: Gracefully handle EPIPE., guix-commits, 2023/06/08
- 08/17: gnu: flashrom: Update to 1.3.0., guix-commits, 2023/06/08
- 03/17: substitute: Gracefully retry after failed partial downloads., guix-commits, 2023/06/08
- 14/17: gnu: Add python-panflute., guix-commits, 2023/06/08
- 17/17: gnu: Add tmux-plugin-continuum., guix-commits, 2023/06/08
- 05/17: doc: Update outdated URL for Eudev wiki., guix-commits, 2023/06/08
- 07/17: gnu: Add rust-uom., guix-commits, 2023/06/08
- 04/17: doc: Replace reference to non-existing (gnu home services ssh-agent)., guix-commits, 2023/06/08
- 11/17: gnu: Add Buildah., guix-commits, 2023/06/08
- 16/17: gnu: octave-cli: Update to 8.2.0, guix-commits, 2023/06/08