From c36eba3cc93092dd6b0937fa676941f01be6a0b0 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Thu, 19 May 2022 09:09:32 +0100 Subject: Improve handling of nar removal When --storage is set and not set. --- scripts/nar-herder.in | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'scripts') 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)))) -- cgit v1.2.3