[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: remote: Start workers only once.
From: |
Mathieu Othacehe |
Subject: |
branch master updated: remote: Start workers only once. |
Date: |
Mon, 01 Feb 2021 12:17:14 -0500 |
This is an automated email from the git hooks/post-receive script.
mothacehe pushed a commit to branch master
in repository guix-cuirass.
The following commit(s) were added to refs/heads/master by this push:
new 79b77b4 remote: Start workers only once.
79b77b4 is described below
commit 79b77b4377db2e79a1f3396cfeeca64bfab00341
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Mon Feb 1 18:16:23 2021 +0100
remote: Start workers only once.
* src/cuirass/remote-worker.scm (%workers-started?): New variable.
(remote-worker): Use it to start workers only once.
---
src/cuirass/remote-worker.scm | 32 ++++++++++++++++++--------------
1 file changed, 18 insertions(+), 14 deletions(-)
diff --git a/src/cuirass/remote-worker.scm b/src/cuirass/remote-worker.scm
index 97a9d7f..f78560f 100644
--- a/src/cuirass/remote-worker.scm
+++ b/src/cuirass/remote-worker.scm
@@ -286,6 +286,8 @@ 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)))
@@ -368,20 +370,22 @@ exiting."
(lambda (action service)
(case action
((new-service)
- (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)))))
+ (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)))))
#:ignore-local? #f
#:types (list remote-server-service-type)
#:stop-loop? (lambda ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: remote: Start workers only once.,
Mathieu Othacehe <=