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
(cherry picked from commit 82f4fc2783)
This commit is contained in:
committed by
Marcus Efraimsson
parent
1b21695b7e
commit
80e5b8318c
@@ -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
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user