[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 05/12: service: 'start-in-the-background' starts services in
From: |
Ludovic Courtès |
Subject: |
[shepherd] 05/12: service: 'start-in-the-background' starts services in parallel. |
Date: |
Sun, 19 Feb 2023 16:58:36 -0500 (EST) |
civodul pushed a commit to branch wip-service-monitor
in repository shepherd.
commit e0cae14f8e42290f9b318090c59eb886e1c7ce16
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Fri Feb 17 22:20:27 2023 +0100
service: 'start-in-the-background' starts services in parallel.
* modules/shepherd/service.scm (start-in-the-background): Use
'start-in-parallel' instead of 'for-each'.
---
modules/shepherd/service.scm | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 0d7c2e1..29f568e 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -946,14 +946,21 @@ This procedure can be useful in a configuration file
because it lets you
interact right away with shepherd using the @command{herd} command."
(spawn-fiber
(lambda ()
- (for-each (lambda (service)
- ;; Keep going if one of SERVICES fails to start.
- (guard (c ((service-error? c)
- (local-output
- (l10n "Failed to start ~a in the background.")
- service)))
- (start service)))
- services)))
+ (match (start-in-parallel services)
+ (()
+ (local-output
+ (l10n "Successfully started ~a service in the background."
+ "Successfully started ~a services in the background."
+ (length services))
+ (length services)))
+ (failures
+ (local-output
+ (l10n "The following service could not be started in the \
+background:~{ ~a~}."
+ "The following services could not be started in the \
+background:~{ ~a~}."
+ (length failures))
+ failures)))))
;; 'spawn-fiber' returns zero values, which can confuse callees; return one.
*unspecified*)
- [shepherd] branch wip-service-monitor created (now da158c5), Ludovic Courtès, 2023/02/19
- [shepherd] 01/12: service: Remove 'stop-delay?' and 'waiting-for-termination?'., Ludovic Courtès, 2023/02/19
- [shepherd] 02/12: service: Handle service state in a monitoring agent., Ludovic Courtès, 2023/02/19
- [shepherd] 06/12: service: 'stop' blocks when a service is already being stopped., Ludovic Courtès, 2023/02/19
- [shepherd] 09/12: service: Rename "service monitor" to "service registry"., Ludovic Courtès, 2023/02/19
- [shepherd] 10/12: service: Clarify expected statuses., Ludovic Courtès, 2023/02/19
- [shepherd] 05/12: service: 'start-in-the-background' starts services in parallel.,
Ludovic Courtès <=
- [shepherd] 03/12: service: 'start' blocks when a service is already being started., Ludovic Courtès, 2023/02/19
- [shepherd] 04/12: service: Start dependent services in parallel., Ludovic Courtès, 2023/02/19
- [shepherd] 07/12: service: 'service-running-value' uses a fresh channel for each reply., Ludovic Courtès, 2023/02/19
- [shepherd] 11/12: service: Communicate the service status symbol to clients., Ludovic Courtès, 2023/02/19
- [shepherd] 12/12: herd: Report 'starting' and 'stopping' service statuses., Ludovic Courtès, 2023/02/19
- [shepherd] 08/12: service: Associate a control fiber with each service., Ludovic Courtès, 2023/02/19