diff options
author | Christopher Baines <mail@cbaines.net> | 2023-05-01 20:09:37 +0200 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-05-01 20:09:37 +0200 |
commit | 935ef75d590c030fbec9d3f56091b07f3bf4880b (patch) | |
tree | d7c9334d451d85e4bade067c553b17da10ed8597 | |
parent | fd834cbcf5b4bb925decd0e2319aa4ec59f9462c (diff) | |
download | nar-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.
-rw-r--r-- | scripts/nar-herder.in | 29 |
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)) |