mirror of
https://github.com/daeuniverse/dae.git
synced 2024-12-22 21:44:55 +07:00
fix: support to report all error when reloading (#540)
This commit is contained in:
parent
2051612931
commit
795bd0560e
@ -147,6 +147,7 @@ func Run(log *logrus.Logger, conf *config.Config, externGeoDataDirs []string) (e
|
|||||||
sigs <- nil
|
sigs <- nil
|
||||||
}()
|
}()
|
||||||
reloading := false
|
reloading := false
|
||||||
|
reloadingErr := error(nil)
|
||||||
isSuspend := false
|
isSuspend := false
|
||||||
abortConnections := false
|
abortConnections := false
|
||||||
loop:
|
loop:
|
||||||
@ -170,7 +171,11 @@ loop:
|
|||||||
}()
|
}()
|
||||||
<-readyChan
|
<-readyChan
|
||||||
sdnotify.Ready()
|
sdnotify.Ready()
|
||||||
_ = os.WriteFile(SignalProgressFilePath, append([]byte{consts.ReloadDone}, []byte("\nOK")...), 0644)
|
if reloadingErr == nil {
|
||||||
|
_ = os.WriteFile(SignalProgressFilePath, append([]byte{consts.ReloadDone}, []byte("\nOK")...), 0644)
|
||||||
|
} else {
|
||||||
|
_ = os.WriteFile(SignalProgressFilePath, append([]byte{consts.ReloadError}, []byte("\n"+reloadingErr.Error())...), 0644)
|
||||||
|
}
|
||||||
log.Warnln("[Reload] Finished")
|
log.Warnln("[Reload] Finished")
|
||||||
} else {
|
} else {
|
||||||
// Listening error.
|
// Listening error.
|
||||||
@ -188,6 +193,7 @@ loop:
|
|||||||
}
|
}
|
||||||
sdnotify.Reloading()
|
sdnotify.Reloading()
|
||||||
_ = os.WriteFile(SignalProgressFilePath, []byte{consts.ReloadProcessing}, 0644)
|
_ = os.WriteFile(SignalProgressFilePath, []byte{consts.ReloadProcessing}, 0644)
|
||||||
|
reloadingErr = nil
|
||||||
|
|
||||||
// Load new config.
|
// Load new config.
|
||||||
abortConnections = os.Remove(AbortFile) == nil
|
abortConnections = os.Remove(AbortFile) == nil
|
||||||
@ -237,6 +243,7 @@ loop:
|
|||||||
log.Warnln("[Reload] Load new control plane")
|
log.Warnln("[Reload] Load new control plane")
|
||||||
newC, err := newControlPlane(log, obj, dnsCache, newConf, externGeoDataDirs)
|
newC, err := newControlPlane(log, obj, dnsCache, newConf, externGeoDataDirs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
reloadingErr = err
|
||||||
log.WithFields(logrus.Fields{
|
log.WithFields(logrus.Fields{
|
||||||
"err": err,
|
"err": err,
|
||||||
}).Errorln("[Reload] Failed to reload; try to roll back configuration")
|
}).Errorln("[Reload] Failed to reload; try to roll back configuration")
|
||||||
|
@ -152,7 +152,11 @@ func (f *Function) String(compact bool, quoteVal bool, omitEmpty bool) string {
|
|||||||
if !(omitEmpty && len(f.Params) == 0) {
|
if !(omitEmpty && len(f.Params) == 0) {
|
||||||
builder.WriteString("(")
|
builder.WriteString("(")
|
||||||
var strParamList []string
|
var strParamList []string
|
||||||
for _, p := range f.Params {
|
for i, p := range f.Params {
|
||||||
|
if i >= 5 {
|
||||||
|
strParamList = append(strParamList, "...")
|
||||||
|
break
|
||||||
|
}
|
||||||
strParamList = append(strParamList, p.String(compact, quoteVal))
|
strParamList = append(strParamList, p.String(compact, quoteVal))
|
||||||
}
|
}
|
||||||
if compact {
|
if compact {
|
||||||
|
Loading…
Reference in New Issue
Block a user