Browse code

daemon/command: don't make notifyReady(), notifyStopping() asynchronous

Leave it to the consumer to decide whether these should be called in a
goroutine.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2024/02/12 22:19:04
Showing 2 changed files
... ...
@@ -336,7 +336,7 @@ func (cli *daemonCLI) start(ctx context.Context) (err error) {
336 336
 	cli.setupConfigReloadTrap()
337 337
 
338 338
 	// after the daemon is done setting up we can notify systemd api
339
-	notifyReady()
339
+	go notifyReady()
340 340
 	log.G(ctx).Info("Daemon has completed initialization")
341 341
 
342 342
 	// Daemon is fully initialized. Start handling API traffic
... ...
@@ -369,7 +369,7 @@ func (cli *daemonCLI) start(ctx context.Context) (err error) {
369 369
 	c.Cleanup()
370 370
 
371 371
 	// notify systemd that we're shutting down
372
-	notifyStopping()
372
+	go notifyStopping()
373 373
 	shutdownDaemon(ctx, d)
374 374
 
375 375
 	// shutdown / close BuildKit backend
... ...
@@ -50,12 +50,12 @@ func preNotifyReady() error {
50 50
 // notifyReady sends a message to the host when the server is ready to be used
51 51
 func notifyReady() {
52 52
 	// Tell the init daemon we are accepting requests
53
-	go systemdDaemon.SdNotify(false, systemdDaemon.SdNotifyReady)
53
+	_, _ = systemdDaemon.SdNotify(false, systemdDaemon.SdNotifyReady)
54 54
 }
55 55
 
56 56
 // notifyStopping sends a message to the host when the server is shutting down
57 57
 func notifyStopping() {
58
-	go systemdDaemon.SdNotify(false, systemdDaemon.SdNotifyStopping)
58
+	_, _ = systemdDaemon.SdNotify(false, systemdDaemon.SdNotifyStopping)
59 59
 }
60 60
 
61 61
 func validateCPURealtimeOptions(cfg *config.Config) error {