forked from TrueCloudLab/frostfs-node
[#937] node: Init node state before gRPC server start
Fix panic when node processes RPC requests before state initialization is finished. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
99f9f8dd08
commit
208d150500
2 changed files with 10 additions and 3 deletions
|
@ -90,6 +90,8 @@ func initNetmapService(c *cfg) {
|
|||
initMorphComponents(c)
|
||||
}
|
||||
|
||||
initNetmapState(c)
|
||||
|
||||
server := netmapTransportGRPC.New(
|
||||
netmapService.NewSignService(
|
||||
&c.key.PrivateKey,
|
||||
|
@ -162,9 +164,9 @@ func initNetmapService(c *cfg) {
|
|||
}
|
||||
}
|
||||
|
||||
// bootstrapNode adds current node to the Network map.
|
||||
// Must be called after initNetmapService.
|
||||
func bootstrapNode(c *cfg) {
|
||||
initState(c)
|
||||
|
||||
if c.needBootstrap() {
|
||||
err := c.bootstrap()
|
||||
fatalOnErrDetails("bootstrap error", err)
|
||||
|
@ -191,7 +193,9 @@ func setNetmapNotificationParser(c *cfg, sTyp string, p event.NotificationParser
|
|||
c.cfgNetmap.parsers[typ] = p
|
||||
}
|
||||
|
||||
func initState(c *cfg) {
|
||||
// initNetmapState inits current Network map state.
|
||||
// Must be called after Morph components initialization.
|
||||
func initNetmapState(c *cfg) {
|
||||
epoch, err := c.cfgNetmap.wrapper.Epoch()
|
||||
fatalOnErrDetails("could not initialize current epoch number", err)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue