mirror of
https://github.com/daeuniverse/dae.git
synced 2024-12-22 16:24:40 +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
|
||||
}()
|
||||
reloading := false
|
||||
reloadingErr := error(nil)
|
||||
isSuspend := false
|
||||
abortConnections := false
|
||||
loop:
|
||||
@ -170,7 +171,11 @@ loop:
|
||||
}()
|
||||
<-readyChan
|
||||
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")
|
||||
} else {
|
||||
// Listening error.
|
||||
@ -188,6 +193,7 @@ loop:
|
||||
}
|
||||
sdnotify.Reloading()
|
||||
_ = os.WriteFile(SignalProgressFilePath, []byte{consts.ReloadProcessing}, 0644)
|
||||
reloadingErr = nil
|
||||
|
||||
// Load new config.
|
||||
abortConnections = os.Remove(AbortFile) == nil
|
||||
@ -237,6 +243,7 @@ loop:
|
||||
log.Warnln("[Reload] Load new control plane")
|
||||
newC, err := newControlPlane(log, obj, dnsCache, newConf, externGeoDataDirs)
|
||||
if err != nil {
|
||||
reloadingErr = err
|
||||
log.WithFields(logrus.Fields{
|
||||
"err": err,
|
||||
}).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) {
|
||||
builder.WriteString("(")
|
||||
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))
|
||||
}
|
||||
if compact {
|
||||
|
Loading…
Reference in New Issue
Block a user