* [bug#68357] [PATCH] service: fix `unload all` * modules/shepherd/service.scm: fix `unload all`
@ 2024-01-10 0:29 zero@fedora
2024-01-10 0:33 ` [bug#68357] [PATCH] shepherd: service: " zero@fedora
2024-01-10 1:30 ` zero@fedora
0 siblings, 2 replies; 6+ messages in thread
From: zero@fedora @ 2024-01-10 0:29 UTC (permalink / raw)
To: 68357; +Cc: zero@fedora
---
modules/shepherd/service.scm | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 5be78bd..54d3400 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -1136,11 +1136,6 @@ requests arriving on @var{channel}."
(length lst))
(map service-canonical-name lst))
(loop registered))))
- (('unregister-all) ;no reply
- (let ((root (cdr (vhash-assq 'root registered))))
- (loop (fold (cut vhash-consq <> root <>)
- vlist-null
- (service-provision root)))))
(('lookup name reply)
;; Look up NAME and return it, or #f, to REPLY.
(put-message reply
@@ -2638,8 +2633,11 @@ requested to be removed."
(let ((name (string->symbol service-name)))
(cond ((eq? name 'all)
;; Special 'remove all' case.
- (put-message (current-registry-channel) `(unregister-all))
- #t)
+ (unregister-services
+ (filter
+ (lambda (sv)
+ (not (eq? (service-canonical-name sv) 'root)))
+ (service-list))))
(else
;; Removing only one service.
(match (lookup-service name)
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [bug#68357] [PATCH] shepherd: service: fix `unload all`
2024-01-10 0:29 [bug#68357] [PATCH] service: fix `unload all` * modules/shepherd/service.scm: fix `unload all` zero@fedora
@ 2024-01-10 0:33 ` zero@fedora
2024-01-10 1:30 ` zero@fedora
1 sibling, 0 replies; 6+ messages in thread
From: zero@fedora @ 2024-01-10 0:33 UTC (permalink / raw)
To: 68357; +Cc: zero@fedora
---
modules/shepherd/service.scm | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 5be78bd..54d3400 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -1136,11 +1136,6 @@ requests arriving on @var{channel}."
(length lst))
(map service-canonical-name lst))
(loop registered))))
- (('unregister-all) ;no reply
- (let ((root (cdr (vhash-assq 'root registered))))
- (loop (fold (cut vhash-consq <> root <>)
- vlist-null
- (service-provision root)))))
(('lookup name reply)
;; Look up NAME and return it, or #f, to REPLY.
(put-message reply
@@ -2638,8 +2633,11 @@ requested to be removed."
(let ((name (string->symbol service-name)))
(cond ((eq? name 'all)
;; Special 'remove all' case.
- (put-message (current-registry-channel) `(unregister-all))
- #t)
+ (unregister-services
+ (filter
+ (lambda (sv)
+ (not (eq? (service-canonical-name sv) 'root)))
+ (service-list))))
(else
;; Removing only one service.
(match (lookup-service name)
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [bug#68357] [PATCH] shepherd: service: fix `unload all`
2024-01-10 0:29 [bug#68357] [PATCH] service: fix `unload all` * modules/shepherd/service.scm: fix `unload all` zero@fedora
2024-01-10 0:33 ` [bug#68357] [PATCH] shepherd: service: " zero@fedora
@ 2024-01-10 1:30 ` zero@fedora
2024-01-14 21:33 ` Ludovic Courtès
1 sibling, 1 reply; 6+ messages in thread
From: zero@fedora @ 2024-01-10 1:30 UTC (permalink / raw)
To: 68357; +Cc: zero@fedora
* modules/shepherd/service.scm: fix `unload all`
---
modules/shepherd/service.scm | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 5be78bd..54d3400 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -1136,11 +1136,6 @@ requests arriving on @var{channel}."
(length lst))
(map service-canonical-name lst))
(loop registered))))
- (('unregister-all) ;no reply
- (let ((root (cdr (vhash-assq 'root registered))))
- (loop (fold (cut vhash-consq <> root <>)
- vlist-null
- (service-provision root)))))
(('lookup name reply)
;; Look up NAME and return it, or #f, to REPLY.
(put-message reply
@@ -2638,8 +2633,11 @@ requested to be removed."
(let ((name (string->symbol service-name)))
(cond ((eq? name 'all)
;; Special 'remove all' case.
- (put-message (current-registry-channel) `(unregister-all))
- #t)
+ (unregister-services
+ (filter
+ (lambda (sv)
+ (not (eq? (service-canonical-name sv) 'root)))
+ (service-list))))
(else
;; Removing only one service.
(match (lookup-service name)
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [bug#68357] [PATCH] shepherd: service: fix `unload all`
2024-01-10 1:30 ` zero@fedora
@ 2024-01-14 21:33 ` Ludovic Courtès
2024-01-14 22:53 ` ShinyZero0
0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2024-01-14 21:33 UTC (permalink / raw)
To: zero@fedora; +Cc: 68357
Hi,
"zero@fedora" <shinyzero0@tilde.club> skribis:
> * modules/shepherd/service.scm: fix `unload all`
Thanks for the patch!
> - (('unregister-all) ;no reply
> - (let ((root (cdr (vhash-assq 'root registered))))
> - (loop (fold (cut vhash-consq <> root <>)
> - vlist-null
> - (service-provision root)))))
> (('lookup name reply)
> ;; Look up NAME and return it, or #f, to REPLY.
> (put-message reply
> @@ -2638,8 +2633,11 @@ requested to be removed."
> (let ((name (string->symbol service-name)))
> (cond ((eq? name 'all)
> ;; Special 'remove all' case.
> - (put-message (current-registry-channel) `(unregister-all))
> - #t)
> + (unregister-services
> + (filter
> + (lambda (sv)
> + (not (eq? (service-canonical-name sv) 'root)))
> + (service-list))))
Do I get it right that the problem with the current implementation is
that services are removed from the registry but not actually stopped?
Ludo’.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [bug#68357] [PATCH] shepherd: service: fix `unload all`
2024-01-14 21:33 ` Ludovic Courtès
@ 2024-01-14 22:53 ` ShinyZero0
2024-01-21 22:23 ` bug#68357: " Ludovic Courtès
0 siblings, 1 reply; 6+ messages in thread
From: ShinyZero0 @ 2024-01-14 22:53 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 68357
Hi Ludo! Thanks for replying.
Yes, that was the problem. `herd reload root all` was leaving the
processes running and many of them crashed or had strange behaviour
after loading, so one had to kill them manually and then restart
the services.
Of course `herd unload root all` was the same.
Best wishes, Paul.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#68357: [PATCH] shepherd: service: fix `unload all`
2024-01-14 22:53 ` ShinyZero0
@ 2024-01-21 22:23 ` Ludovic Courtès
0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2024-01-21 22:23 UTC (permalink / raw)
To: ShinyZero0; +Cc: 68357-done
Hi!
"ShinyZero0" <shinyzero0@tilde.club> skribis:
> Yes, that was the problem. `herd reload root all` was leaving the
> processes running and many of them crashed or had strange behaviour
> after loading, so one had to kill them manually and then restart
> the services.
>
> Of course `herd unload root all` was the same.
>
> Best wishes, Paul.
Thanks for clarifying. I pushed something similar along with a test as
commit b7fcdad75dff73fb4a8f531d0834eb9a965bcfd6.
Ludo’.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-01-21 22:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-10 0:29 [bug#68357] [PATCH] service: fix `unload all` * modules/shepherd/service.scm: fix `unload all` zero@fedora
2024-01-10 0:33 ` [bug#68357] [PATCH] shepherd: service: " zero@fedora
2024-01-10 1:30 ` zero@fedora
2024-01-14 21:33 ` Ludovic Courtès
2024-01-14 22:53 ` ShinyZero0
2024-01-21 22:23 ` bug#68357: " Ludovic Courtès
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).