mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
First of all, we should not send the unix time, but the monotonic time. Second of all, RELOADING= and MONOTONIC_USEC fields should be sent in *single* message not two separate messages. From the man page of [systemd.service](https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html#Type=) > notification message via sd_notify(3) that contains the "RELOADING=1" field in > combination with "MONOTONIC_USEC=" set to the current monotonic time (i.e. > CLOCK_MONOTONIC in clock_gettime(2)) in μs, formatted as decimal string. [sd_notify](https://www.freedesktop.org/software/systemd/man/latest/sd_notify.html) now has code samples of the protocol to clarify. Without these changes, if you'd set Type=notify-reload on the agen'ts systemd unit, systemd would kill the service due to the service not responding to reload correctly.
19 lines
267 B
Go
19 lines
267 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
//go:build !linux
|
|
|
|
package agent
|
|
|
|
import (
|
|
"io"
|
|
)
|
|
|
|
func openNotify() (io.WriteCloser, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func sdNotify(_ io.Writer, _ string) {}
|
|
|
|
func sdNotifyReloading(_ io.Writer) {}
|