[#312] cmd/node: Switch health status while the application is running

Switch health status to:
  * STARTING after the initialization of app resources and before bootup;
  * READY after bootup and until shutting down;
  * SHUTTING_DOWN before exiting the application.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-01-15 13:28:37 +03:00 committed by Alex Vanin
parent 147399f547
commit 4666a7797b

View file

@ -5,6 +5,7 @@ import (
"flag" "flag"
"log" "log"
"github.com/nspcc-dev/neofs-node/pkg/services/control"
"github.com/nspcc-dev/neofs-node/pkg/util/grace" "github.com/nspcc-dev/neofs-node/pkg/util/grace"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -23,10 +24,16 @@ func main() {
initApp(c) initApp(c)
c.setHealthStatus(control.HealthStatus_STARTING)
bootUp(c) bootUp(c)
c.setHealthStatus(control.HealthStatus_READY)
wait(c) wait(c)
c.setHealthStatus(control.HealthStatus_SHUTTING_DOWN)
shutdown(c) shutdown(c)
} }