Skip to content
Snippets Groups Projects
Unverified Commit 75c44bb5 authored by Mathieu Othacehe's avatar Mathieu Othacehe
Browse files

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.
parent 485ed918
No related branches found
No related tags found
No related merge requests found
...@@ -286,8 +286,6 @@ and executing them. The worker can reply on the same socket." ...@@ -286,8 +286,6 @@ and executing them. The worker can reply on the same socket."
(define %worker-pids (define %worker-pids
(make-atomic-box '())) (make-atomic-box '()))
(define %workers-started? #f)
(define (load-server file) (define (load-server file)
(let ((user-module (make-user-module '((cuirass remote))))) (let ((user-module (make-user-module '((cuirass remote)))))
(load* file user-module))) (load* file user-module)))
...@@ -363,30 +361,30 @@ exiting." ...@@ -363,30 +361,30 @@ exiting."
(publish-url publish-url) (publish-url publish-url)
(systems systems)) (systems systems))
server)))) server))))
(iota workers)) (iota workers)))
(while #t
(sleep 1)))
(avahi-browse-service-thread (avahi-browse-service-thread
(lambda (action service) (lambda (action service)
(case action (case action
((new-service) ((new-service)
(unless %workers-started? (for-each
(for-each (lambda (n)
(lambda (n) (let* ((address (or address
(let* ((address (or address (avahi-service-local-address service)))
(avahi-service-local-address service))) (publish-url (local-publish-url address)))
(publish-url (local-publish-url address))) (add-to-worker-pids!
(add-to-worker-pids! (start-worker (worker
(start-worker (worker (name (generate-worker-name))
(name (generate-worker-name)) (address address)
(address address) (machine (gethostname))
(machine (gethostname)) (publish-url publish-url)
(publish-url publish-url) (systems systems))
(systems systems)) (avahi-service->server service)))))
(avahi-service->server service))))) (iota workers))
(iota workers)) (atomic-box-set! %stop-process? #t))))
(set! %workers-started? #t)))))
#:ignore-local? #f #:ignore-local? #f
#:types (list remote-server-service-type) #:types (list remote-server-service-type)
#:stop-loop? (lambda () #:stop-loop? (lambda ()
(atomic-box-ref %stop-process?))))))) (atomic-box-ref %stop-process?))))
(while #t
(sleep 1)))))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment