Skip to content

Commit 5d94915

Browse files
authored
Merge pull request moby#52039 from vvoland/revert-51965
Temporarily revert: daemon/command: add support for sd_notify "reload" notifications
2 parents 0b56144 + c6ca7d4 commit 5d94915

File tree

4 files changed

+2
-36
lines changed

4 files changed

+2
-36
lines changed

daemon/command/daemon.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -531,13 +531,6 @@ func (cli *daemonCLI) reloadConfig() {
531531
}
532532
}
533533

534-
// On Linux, we use sd_notify to indicate we're reloading config. We send
535-
// this signal as early as possible to let systemd know we're reloading,
536-
// but must signal "ready" after this completes (even on failure), which
537-
// is done by the reload function defined above.
538-
done := notifyReloading()
539-
defer done()
540-
541534
if err := config.Reload(*cli.configFile, cli.flags, reload); err != nil {
542535
log.G(ctx).WithError(err).Error("Error reloading configuration")
543536
return

daemon/command/daemon_freebsd.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ func preNotifyReady() error {
1111
func notifyReady() {
1212
}
1313

14-
// notifyReloading sends a message to the host when the server got signaled to
15-
// reloading its configuration. It is a no-op on FreeBSD.
16-
func notifyReloading() func() { return func() {} }
17-
1814
// notifyStopping sends a message to the host when the server is shutting down
1915
func notifyStopping() {
2016
}

daemon/command/daemon_linux.go

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,12 @@ func preNotifyReady() error {
5050
// notifyReady sends a message to the host when the server is ready to be used
5151
func notifyReady() {
5252
// Tell the init daemon we are accepting requests
53-
_, _ = systemdDaemon.SdNotify(false, systemdDaemon.SdNotifyReady)
53+
go systemdDaemon.SdNotify(false, systemdDaemon.SdNotifyReady)
5454
}
5555

5656
// notifyStopping sends a message to the host when the server is shutting down
5757
func notifyStopping() {
58-
_, _ = systemdDaemon.SdNotify(false, systemdDaemon.SdNotifyStopping)
59-
}
60-
61-
// notifyReloading sends a message to the host when the server got signaled to
62-
// reloading its configuration, see [sd_notify(3)]. The server should be running
63-
// as a systemd unit with "Type=notify" or "Type=notify-reload" (see
64-
// [systemd.service(5)]).
65-
//
66-
// notifyReloading returns a callback that must be called after reloading completes
67-
// (either successfully or unsuccessfully) to send [notifyReady].
68-
//
69-
// [sd_notify(3)]: https://www.freedesktop.org/software/systemd/man/latest/sd_notify.html#RELOADING=1
70-
// [systemd.service(5)]: https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html#Type=
71-
func notifyReloading() (done func()) {
72-
sent, _ := systemdDaemon.SdNotify(false, systemdDaemon.SdNotifyReloading+"\n"+systemdDaemon.SdNotifyMonotonicUsec())
73-
if !sent {
74-
// Nothing to do if no reloading event was sent.
75-
return func() {}
76-
}
77-
return notifyReady
58+
go systemdDaemon.SdNotify(false, systemdDaemon.SdNotifyStopping)
7859
}
7960

8061
func validateCPURealtimeOptions(cfg *config.Config) error {

daemon/command/daemon_windows.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ func preNotifyReady() error {
5656
func notifyReady() {
5757
}
5858

59-
// notifyReloading sends a message to the host when the server got signaled to
60-
// reloading its configuration. It is a no-op on Windows.
61-
func notifyReloading() func() { return func() {} }
62-
6359
// notifyStopping sends a message to the host when the server is shutting down
6460
func notifyStopping() {
6561
}

0 commit comments

Comments
 (0)