aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-05-01 20:09:37 +0200
committerChristopher Baines <mail@cbaines.net>2023-05-01 20:09:37 +0200
commit935ef75d590c030fbec9d3f56091b07f3bf4880b (patch)
treed7c9334d451d85e4bade067c553b17da10ed8597 /scripts
parentfd834cbcf5b4bb925decd0e2319aa4ec59f9462c (diff)
downloadnar-herder-935ef75d590c030fbec9d3f56091b07f3bf4880b.tar
nar-herder-935ef75d590c030fbec9d3f56091b07f3bf4880b.tar.gz
Support setting a storage limit with no nar removal criteria
As a way of limiting the storage space used, but without removing any nars. While this will mean if you reduce the storage limit, no nars will be removed, I still think this is a useful way to run the nar-herder.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/nar-herder.in29
1 files changed, 16 insertions, 13 deletions
diff --git a/scripts/nar-herder.in b/scripts/nar-herder.in
index 9845e46..c4a4bd2 100644
--- a/scripts/nar-herder.in
+++ b/scripts/nar-herder.in
@@ -617,19 +617,22 @@
metrics-registry))))
- (when (and (assq-ref opts 'storage)
- (number? (assq-ref opts 'storage-limit)))
- (start-nar-removal-thread database
- canonical-storage
- (assq-ref opts 'storage-limit)
- metrics-registry
- (filter-map
- (match-lambda
- ((key . val)
- (if (eq? key 'storage-nar-removal-criteria)
- val
- #f)))
- opts)))
+ (let ((nar-removal-criteria
+ (filter-map
+ (match-lambda
+ ((key . val)
+ (if (eq? key 'storage-nar-removal-criteria)
+ val
+ #f)))
+ opts)))
+ (when (and (assq-ref opts 'storage)
+ (number? (assq-ref opts 'storage-limit))
+ (not (null? nar-removal-criteria)))
+ (start-nar-removal-thread database
+ canonical-storage
+ (assq-ref opts 'storage-limit)
+ metrics-registry
+ nar-removal-criteria)))
(log-msg 'INFO "starting server, listening on "
(assq-ref opts 'host) ":" (assq-ref opts 'port))