aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2022-05-19 09:09:32 +0100
committerChristopher Baines <mail@cbaines.net>2022-05-19 09:09:32 +0100
commitc36eba3cc93092dd6b0937fa676941f01be6a0b0 (patch)
tree66b70f711b2f779ba2f6f254741c9ce2578e567a
parent285437697d524f4205a7f1c25a23d9ef771412f2 (diff)
downloadnar-herder-c36eba3cc93092dd6b0937fa676941f01be6a0b0.tar
nar-herder-c36eba3cc93092dd6b0937fa676941f01be6a0b0.tar.gz
Improve handling of nar removal
When --storage is set and not set.
-rw-r--r--scripts/nar-herder.in24
1 files changed, 14 insertions, 10 deletions
diff --git a/scripts/nar-herder.in b/scripts/nar-herder.in
index 32a2afa..8ade7fb 100644
--- a/scripts/nar-herder.in
+++ b/scripts/nar-herder.in
@@ -278,16 +278,20 @@
(lambda (store-path)
(log-msg 'INFO "removing " store-path)
- ;; Removing the files here isn't ideal, since the servers
- ;; metrics won't be updated until the next get-nar-files call,
- ;; but it avoids extra complexity in trying to have the server
- ;; delete the files.
- (remove-nar-files-by-hash
- database
- (assq-ref opts 'storage)
- (make-metrics-registry #:namespace
- "narherder")
- (store-path-hash-part store-path))
+ (if (assq-ref opts 'storage)
+ (begin
+ ;; Removing the files here isn't ideal, since the servers
+ ;; metrics won't be updated until the next get-nar-files call,
+ ;; but it avoids extra complexity in trying to have the server
+ ;; delete the files.
+ (remove-nar-files-by-hash
+ database
+ (assq-ref opts 'storage)
+ (make-metrics-registry #:namespace
+ "narherder")
+ (store-path-hash-part store-path)))
+ (log-msg
+ 'WARN "no --storage set, so just removing from the database"))
(database-remove-narinfo database store-path))
(assq-ref opts 'arguments))))