Improve server start handling to avoid service failure due to timeout.
This commit is contained in:
parent
88f8e88805
commit
b0de9be277
Binary file not shown.
10
listener.go
10
listener.go
@ -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.
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user