[#306] cmd/node: Switch health status on boot and shutdown

Implement HealthChecker on node app structure. Set health status to ONLINE
after node boot. Set health status to OFFLINE on shutdown.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-01-13 16:36:41 +03:00 committed by Alex Vanin
parent 44a0fb5a69
commit df3746fa68
4 changed files with 20 additions and 0 deletions

View file

@ -8,6 +8,7 @@ import (
netmapEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap"
netmapTransportGRPC "github.com/nspcc-dev/neofs-node/pkg/network/transport/netmap/grpc"
netmapService "github.com/nspcc-dev/neofs-node/pkg/services/netmap"
"github.com/nspcc-dev/neofs-node/pkg/services/private"
"github.com/pkg/errors"
"go.uber.org/atomic"
"go.uber.org/zap"
@ -116,6 +117,8 @@ func addNewEpochNotificationHandler(c *cfg, h event.Handler) {
}
func goOffline(c *cfg) {
c.setHealthStatus(private.HealthStatus_OFFLINE)
err := c.cfgNetmap.wrapper.UpdatePeerState(
crypto.MarshalPublicKey(&c.key.PublicKey),
netmap.NodeStateOffline,