aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2022-05-04 18:19:22 +0100
committerChristopher Baines <mail@cbaines.net>2022-05-04 18:19:22 +0100
commit90ec2f677a38c2bef0b4d4703b68e53015e344b6 (patch)
treeff54dd63bfd02af6111d2f6e60ebc832f8511862 /scripts
parentaf46b8bcd3fa8df648b911c422512c41bfa2a4f6 (diff)
downloadnar-herder-90ec2f677a38c2bef0b4d4703b68e53015e344b6.tar
nar-herder-90ec2f677a38c2bef0b4d4703b68e53015e344b6.tar.gz
Create the pid file prior to downloading the database
Otherwise, anything starting the service may time out if the database file is large.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/nar-herder.in11
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/nar-herder.in b/scripts/nar-herder.in
index c572106..e6f4a0b 100644
--- a/scripts/nar-herder.in
+++ b/scripts/nar-herder.in
@@ -322,6 +322,12 @@
"error: you must specify --mirror or --storage\n")
(exit 1))
+ (and=> (assq-ref opts 'pid-file)
+ (lambda (pid-file)
+ (call-with-output-file pid-file
+ (lambda (port)
+ (simple-format port "~A\n" (getpid))))))
+
(and=>
(assq-ref opts 'mirror)
(lambda (mirror)
@@ -340,11 +346,6 @@
(let ((database (setup-database (assq-ref opts 'database)))
(canonical-storage (and=> (assq-ref opts 'storage)
canonicalize-path)))
- (and=> (assq-ref opts 'pid-file)
- (lambda (pid-file)
- (call-with-output-file pid-file
- (lambda (port)
- (simple-format port "~A\n" (getpid))))))
(when (not (file-exists? (assq-ref opts 'database-dump)))
(log-msg 'INFO "dumping database...")