aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2021-12-29 22:11:59 +0000
committerChristopher Baines <mail@cbaines.net>2021-12-29 22:11:59 +0000
commit28b67c85acefc578536bf849cb748bd9345ee3b9 (patch)
tree2244c4a9e17993cfb2caa2014d848334db8781e3 /scripts
parentb7722aed5f91fa7d44343e7ce091e4dccc879430 (diff)
downloadnar-herder-28b67c85acefc578536bf849cb748bd9345ee3b9.tar
nar-herder-28b67c85acefc578536bf849cb748bd9345ee3b9.tar.gz
Regularly update the database dump and delete recent changes
Diffstat (limited to 'scripts')
-rw-r--r--scripts/nar-herder.in16
1 files changed, 15 insertions, 1 deletions
diff --git a/scripts/nar-herder.in b/scripts/nar-herder.in
index bbfaeea..a969910 100644
--- a/scripts/nar-herder.in
+++ b/scripts/nar-herder.in
@@ -55,6 +55,7 @@
((guix build utils) #:select (dump-port))
(nar-herder utils)
(nar-herder database)
+ (nar-herder recent-changes)
(nar-herder storage)
(nar-herder mirror)
(nar-herder server))
@@ -115,6 +116,12 @@
(cons (string->symbol sym) rest)))
result)))
+ (option '("recent-changes-limit") #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'recent-changes-limit
+ (string->number arg)
+ (alist-delete 'recent-changes-limit result))))
+
(option '("mirror") #t #f
(lambda (opt name arg result)
(alist-cons 'mirror
@@ -125,7 +132,8 @@
'((port . 8080)
(host . "0.0.0.0")
- (storage-limit . "none")))
+ (storage-limit . "none")
+ (recent-changes-limit . 32768)))
(define (parse-options options defaults args)
(args-fold
@@ -276,6 +284,12 @@
"dumping database...\n")
(dump-database database (assq-ref opts 'database-dump)))
+ (start-recent-change-removal-and-database-dump-thread
+ database
+ (assq-ref opts 'database-dump)
+ (* 24 3600) ; 24 hours
+ (assq-ref opts 'recent-changes-limit))
+
(and=> (assq-ref opts 'mirror)
(lambda (mirror)
(start-fetch-changes-thread database mirror)