[#304] cmd/neofs-node: Catch closing channel of listener endpoint

As in #72 storage application should behave the same way at remote
RPC node failures. The simplest way is to restart application. Later
we can reinitialize it without downtime.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-01-12 14:05:08 +03:00 committed by Alex Vanin
parent 1e170c3812
commit 3774c5d69a
3 changed files with 27 additions and 9 deletions

View file

@ -1,6 +1,7 @@
package main
import (
"context"
"fmt"
"github.com/nspcc-dev/neo-go/pkg/util"
@ -51,7 +52,9 @@ func listenMorphNotifications(c *cfg) {
})
fatalOnErr(err)
c.workers = append(c.workers, newWorkerFromFunc(lis.Listen))
c.workers = append(c.workers, newWorkerFromFunc(func(ctx context.Context) {
lis.ListenWithError(ctx, c.internalErr)
}))
setNetmapNotificationParser(c, newEpochNotification, netmapEvent.ParseNewEpoch)
registerNotificationHandlers(c.cfgNetmap.scriptHash, lis, c.cfgNetmap.parsers, c.cfgNetmap.subscribers)