aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nar-herder/mirror.scm7
-rw-r--r--nar-herder/storage.scm6
-rw-r--r--scripts/nar-herder.in4
3 files changed, 14 insertions, 3 deletions
diff --git a/nar-herder/mirror.scm b/nar-herder/mirror.scm
index 11f7136..57103a4 100644
--- a/nar-herder/mirror.scm
+++ b/nar-herder/mirror.scm
@@ -32,9 +32,11 @@
#:use-module (guix narinfo)
#:use-module (nar-herder utils)
#:use-module (nar-herder database)
+ #:use-module (nar-herder storage)
#:export (start-fetch-changes-thread))
-(define (start-fetch-changes-thread database mirror metrics-registry)
+(define (start-fetch-changes-thread database storage-root
+ mirror metrics-registry)
(define nar-files-metric
(or (metrics-registry-fetch-metric metrics-registry
"nar_files_total")
@@ -134,6 +136,9 @@
(call-with-new-thread
(lambda ()
+ ;; This will initialise the nar_files_total metric
+ (get-nar-files database storage-root metrics-registry)
+
(while #t
(request-recent-changes)
diff --git a/nar-herder/storage.scm b/nar-herder/storage.scm
index ae44f39..090e974 100644
--- a/nar-herder/storage.scm
+++ b/nar-herder/storage.scm
@@ -35,6 +35,8 @@
#:use-module (nar-herder database)
#:export (store-item-in-local-storage?
+ get-nar-files
+
start-nar-removal-thread
start-mirroring-thread))
@@ -104,7 +106,9 @@
storage-root))
(let* ((files-hash
- (get-files-hash))
+ (if storage-root
+ (get-files-hash)
+ (make-hash-table)))
(narinfo-files
(database-map-all-narinfo-files
database
diff --git a/scripts/nar-herder.in b/scripts/nar-herder.in
index e6f4a0b..165c0e4 100644
--- a/scripts/nar-herder.in
+++ b/scripts/nar-herder.in
@@ -359,7 +359,9 @@
(and=> (assq-ref opts 'mirror)
(lambda (mirror)
- (start-fetch-changes-thread database mirror
+ (start-fetch-changes-thread database
+ canonical-storage
+ mirror
metrics-registry)
(when (assq-ref opts 'storage)