forked from TrueCloudLab/frostfs-node
[#1643] innerring: Exit if we cannot bind to the control endpoint
Return listen errors in a synchronous fashion. Another solution would be to use buffered channel, but this is not scalable: for each new similar runner we would need to extend the buffer. Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
parent
0a60524a9c
commit
9a5f9d6f0e
2 changed files with 8 additions and 5 deletions
|
@ -10,6 +10,7 @@ Changelog for NeoFS Node
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Losing request context in eACL response checks (#1595)
|
- Losing request context in eACL response checks (#1595)
|
||||||
|
- `neofs-ir` no longer hangs if it cannot bind to the control endpoint (#1643)
|
||||||
- Do not require `lifetime` flag in `session create` CLI command (#1655)
|
- Do not require `lifetime` flag in `session create` CLI command (#1655)
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
|
@ -121,7 +121,7 @@ type (
|
||||||
// Set of component runners which
|
// Set of component runners which
|
||||||
// should report start errors
|
// should report start errors
|
||||||
// to the application.
|
// to the application.
|
||||||
runners []func(chan<- error)
|
runners []func(chan<- error) error
|
||||||
|
|
||||||
subnetHandler
|
subnetHandler
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,9 @@ func (s *Server) Start(ctx context.Context, intError chan<- error) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, runner := range s.runners {
|
for _, runner := range s.runners {
|
||||||
runner(intError)
|
if err := runner(intError); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
go s.morphListener.ListenWithError(ctx, morphErr) // listen for neo:morph events
|
go s.morphListener.ListenWithError(ctx, morphErr) // listen for neo:morph events
|
||||||
|
@ -891,16 +893,16 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper, errChan chan<-
|
||||||
grpcControlSrv := grpc.NewServer()
|
grpcControlSrv := grpc.NewServer()
|
||||||
control.RegisterControlServiceServer(grpcControlSrv, controlSvc)
|
control.RegisterControlServiceServer(grpcControlSrv, controlSvc)
|
||||||
|
|
||||||
server.runners = append(server.runners, func(ch chan<- error) {
|
server.runners = append(server.runners, func(ch chan<- error) error {
|
||||||
lis, err := net.Listen("tcp", controlSvcEndpoint)
|
lis, err := net.Listen("tcp", controlSvcEndpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ch <- err
|
return err
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
ch <- grpcControlSrv.Serve(lis)
|
ch <- grpcControlSrv.Serve(lis)
|
||||||
}()
|
}()
|
||||||
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
server.registerNoErrCloser(grpcControlSrv.GracefulStop)
|
server.registerNoErrCloser(grpcControlSrv.GracefulStop)
|
||||||
|
|
Loading…
Reference in a new issue