guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]


From: Mathieu Othacehe
Date: Sat, 6 Feb 2021 03:43:35 -0500 (EST)

branch: master
commit 75c44bb57926391d67f8c33dd58a135694239dd0
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Sat Feb 6 09:41:11 2021 +0100

    remote: Stop polling once the workers are started.
    
    * src/cuirass/remote-worker.scm (remote-worker): Stop the avahi poll loop 
once
    the workers are started.
---
 src/cuirass/remote-worker.scm | 42 ++++++++++++++++++++----------------------
 1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/src/cuirass/remote-worker.scm b/src/cuirass/remote-worker.scm
index f78560f..339e0ec 100644
--- a/src/cuirass/remote-worker.scm
+++ b/src/cuirass/remote-worker.scm
@@ -286,8 +286,6 @@ and executing them.  The worker can reply on the same 
socket."
 (define %worker-pids
   (make-atomic-box '()))
 
-(define %workers-started? #f)
-
 (define (load-server file)
   (let ((user-module (make-user-module '((cuirass remote)))))
     (load* file user-module)))
@@ -363,30 +361,30 @@ exiting."
                                  (publish-url publish-url)
                                  (systems systems))
                                 server))))
-             (iota workers))
-            (while #t
-              (sleep 1)))
+             (iota workers)))
           (avahi-browse-service-thread
            (lambda (action service)
              (case action
                ((new-service)
-                (unless %workers-started?
-                  (for-each
-                   (lambda (n)
-                     (let* ((address (or address
-                                         (avahi-service-local-address 
service)))
-                            (publish-url (local-publish-url address)))
-                       (add-to-worker-pids!
-                        (start-worker (worker
-                                       (name (generate-worker-name))
-                                       (address address)
-                                       (machine (gethostname))
-                                       (publish-url publish-url)
-                                       (systems systems))
-                                      (avahi-service->server service)))))
-                   (iota workers))
-                  (set! %workers-started? #t)))))
+                (for-each
+                 (lambda (n)
+                   (let* ((address (or address
+                                       (avahi-service-local-address service)))
+                          (publish-url (local-publish-url address)))
+                     (add-to-worker-pids!
+                      (start-worker (worker
+                                     (name (generate-worker-name))
+                                     (address address)
+                                     (machine (gethostname))
+                                     (publish-url publish-url)
+                                     (systems systems))
+                                    (avahi-service->server service)))))
+                 (iota workers))
+                (atomic-box-set! %stop-process? #t))))
            #:ignore-local? #f
            #:types (list remote-server-service-type)
            #:stop-loop? (lambda ()
-                          (atomic-box-ref %stop-process?)))))))
+                          (atomic-box-ref %stop-process?))))
+
+      (while #t
+        (sleep 1)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]