From c4d6c32de39eedffb3c4c0982a85545472eef057 Mon Sep 17 00:00:00 2001
From: Christopher Baines <mail@cbaines.net>
Date: Fri, 10 Nov 2023 11:02:03 +0000
Subject: Create the pid file even earlier

---
 bffe/server.scm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/bffe/server.scm b/bffe/server.scm
index 1940488..76f8212 100644
--- a/bffe/server.scm
+++ b/bffe/server.scm
@@ -602,6 +602,11 @@
           pid-file
           metrics-registry)
 
+  (when pid-file
+    (call-with-output-file pid-file
+      (lambda (port)
+        (simple-format port "~A\n" (getpid)))))
+
   (let* ((state-channel
           (make-state-channel
            event-source))
@@ -629,11 +634,6 @@
                    event-source
                    controller-args)))
 
-      (when pid-file
-        (call-with-output-file pid-file
-          (lambda (port)
-            (simple-format port "~A\n" (getpid)))))
-
       ;; Wait until the events channel catches up
       (while (< (get-state-id) initial-state-id)
         (sleep 1))
-- 
cgit v1.2.3