Improve server start handling to avoid service failure due to timeout.

This commit is contained in:
GRMrGecko 2025-01-08 13:12:31 -06:00
parent 88f8e88805
commit b0de9be277
3 changed files with 9 additions and 16 deletions

Binary file not shown.

View File

@ -36,16 +36,6 @@ type Listener struct {
log *log.Entry
}
// Check if IP address is all zero.
func isZeroAddr(ip net.IP) bool {
for _, b := range ip {
if b != 0x0 {
return false
}
}
return true
}
// Make a new listener on the specified address. This
// listener is added to the app listener list, and errors
// on existing listeners for the specified address.

View File

@ -47,12 +47,15 @@ func (a *ServerCmd) Run() error {
return err
}
// Apply the configuration read.
err = ApplyConfig(config)
// If error applying the config, we should fail.
if err != nil {
return err
}
// Apply the configuration in the background, to allow service start to notify
// the service managers fast.
go func() {
err = ApplyConfig(config)
// If error applying the config, log.
if err != nil {
log.Println("An error occurred applying configuration:", err)
}
}()
}
// Send notification that the service is ready.