forked from TrueCloudLab/frostfs-node
[#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:
parent
44a0fb5a69
commit
df3746fa68
4 changed files with 20 additions and 0 deletions
|
@ -41,6 +41,7 @@ func initPrivateService(c *cfg) {
|
|||
privSvc := privateSvc.New(
|
||||
privateSvc.WithKey(c.key),
|
||||
privateSvc.WithAllowedKeys(keys),
|
||||
privateSvc.WithHealthChecker(c),
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -65,3 +66,11 @@ func initPrivateService(c *cfg) {
|
|||
fatalOnErr(c.cfgPrivateService.server.Serve(lis))
|
||||
}))
|
||||
}
|
||||
|
||||
func (c *cfg) setHealthStatus(st private.HealthStatus) {
|
||||
c.healthStatus.Store(int32(st))
|
||||
}
|
||||
|
||||
func (c *cfg) HealthStatus() private.HealthStatus {
|
||||
return private.HealthStatus(c.healthStatus.Load())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue