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

remote: Start workers only once.

* src/cuirass/remote-worker.scm (%workers-started?): New variable.
(remote-worker): Use it to start workers only once.
parent a57b066e
No related branches found
No related tags found
No related merge requests found
...@@ -286,6 +286,8 @@ and executing them. The worker can reply on the same socket." ...@@ -286,6 +286,8 @@ 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)))
...@@ -368,20 +370,22 @@ exiting." ...@@ -368,20 +370,22 @@ exiting."
(lambda (action service) (lambda (action service)
(case action (case action
((new-service) ((new-service)
(for-each (unless %workers-started?
(lambda (n) (for-each
(let* ((address (or address (lambda (n)
(avahi-service-local-address service))) (let* ((address (or address
(publish-url (local-publish-url address))) (avahi-service-local-address service)))
(add-to-worker-pids! (publish-url (local-publish-url address)))
(start-worker (worker (add-to-worker-pids!
(name (generate-worker-name)) (start-worker (worker
(address address) (name (generate-worker-name))
(machine (gethostname)) (address address)
(publish-url publish-url) (machine (gethostname))
(systems systems)) (publish-url publish-url)
(avahi-service->server service))))) (systems systems))
(iota workers))))) (avahi-service->server service)))))
(iota workers))
(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 ()
......
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