multi: return error if connecting to remote sub-server fails

This commit is contained in:
Elle Mouton 2023-05-03 08:04:28 +02:00
parent daab70c040
commit 2a825f1009
No known key found for this signature in database
GPG key ID: D7D916376026F177
2 changed files with 8 additions and 5 deletions

View file

@ -84,7 +84,7 @@ func (s *Manager) StartIntegratedServers(lndClient lnrpc.LightningClient,
// ConnectRemoteSubServers creates connections to all the manager's sub-servers
// that are running remotely.
func (s *Manager) ConnectRemoteSubServers() {
func (s *Manager) ConnectRemoteSubServers() error {
s.mu.Lock()
defer s.mu.Unlock()
@ -95,12 +95,12 @@ func (s *Manager) ConnectRemoteSubServers() {
err := ss.connectRemote()
if err != nil {
log.Errorf("Failed to connect to remote %s: %v",
return fmt.Errorf("failed to connect to remote %s: %v",
ss.Name(), err)
continue
}
}
return nil
}
// RegisterRPCServices registers all the manager's sub-servers with the given

View file

@ -491,7 +491,10 @@ func (g *LightningTerminal) start() error {
// Initialise any connections to sub-servers that we are running in
// remote mode.
g.subServerMgr.ConnectRemoteSubServers()
if err := g.subServerMgr.ConnectRemoteSubServers(); err != nil {
return fmt.Errorf("error connecting to remote sub-servers: %v",
err)
}
// Now start the RPC proxy that will handle all incoming gRPC, grpc-web
// and REST requests.