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
|
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
|
// Make a new listener on the specified address. This
|
||||||
// listener is added to the app listener list, and errors
|
// listener is added to the app listener list, and errors
|
||||||
// on existing listeners for the specified address.
|
// on existing listeners for the specified address.
|
||||||
|
@ -47,12 +47,15 @@ func (a *ServerCmd) Run() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply the configuration read.
|
// Apply the configuration in the background, to allow service start to notify
|
||||||
err = ApplyConfig(config)
|
// the service managers fast.
|
||||||
// If error applying the config, we should fail.
|
go func() {
|
||||||
if err != nil {
|
err = ApplyConfig(config)
|
||||||
return err
|
// If error applying the config, log.
|
||||||
}
|
if err != nil {
|
||||||
|
log.Println("An error occurred applying configuration:", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send notification that the service is ready.
|
// Send notification that the service is ready.
|
||||||
|
Loading…
Reference in New Issue
Block a user