Fail when server is unable to bind port (#20409)

* Server: Return error when unable to bind port
* Server: Exit if a service fails
* Build: Remove graceful kill from Bra config
This commit is contained in:
Arve Knudsen
2019-11-18 09:49:08 +01:00
committed by GitHub
parent 85b7ddefc0
commit 82f4fc2783
3 changed files with 10 additions and 9 deletions

View File

@@ -103,7 +103,7 @@ func (s *Server) Run() (err error) {
s.log.Info("Initializing " + service.Name)
if err := service.Instance.Init(); err != nil {
return fmt.Errorf("Service init failed: %v", err)
return errutil.Wrapf(err, "Service init failed")
}
}
@@ -126,18 +126,21 @@ func (s *Server) Run() (err error) {
return nil
}
if err := service.Run(s.context); err != nil {
err := service.Run(s.context)
// Mark that we are in shutdown mode
// So no more services are started
s.shutdownInProgress = true
if err != nil {
if err != context.Canceled {
// Server has crashed.
s.log.Error("Stopped "+descriptor.Name, "reason", err)
} else {
s.log.Info("Stopped "+descriptor.Name, "reason", err)
}
return err
}
// Mark that we are in shutdown mode
// So more services are not started
s.shutdownInProgress = true
return nil
})
}