Merge remote-tracking branch 'origin/main' into protocol-errors
This commit is contained in:
commit
2be7753ed9
@ -9,6 +9,10 @@ type ConfigGetter interface {
|
|||||||
GetNodeConf() Configuration
|
GetNodeConf() Configuration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ConfigUpdateGetter interface {
|
||||||
|
GetNodeConfUpdateInterval() int
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrConfigurationNotFound = errors.New("node nodeConf not found")
|
ErrConfigurationNotFound = errors.New("node nodeConf not found")
|
||||||
)
|
)
|
||||||
|
|||||||
@ -49,7 +49,12 @@ func (s *service) Init(a *app.App) (err error) {
|
|||||||
lastStored = s.config
|
lastStored = s.config
|
||||||
err = nil
|
err = nil
|
||||||
}
|
}
|
||||||
s.sync = periodicsync.NewPeriodicSync(600, 0, func(ctx context.Context) (err error) {
|
var updatePeriodSec = 600
|
||||||
|
if confUpd, ok := a.MustComponent("config").(ConfigUpdateGetter); ok && confUpd.GetNodeConfUpdateInterval() > 0 {
|
||||||
|
updatePeriodSec = confUpd.GetNodeConfUpdateInterval()
|
||||||
|
}
|
||||||
|
|
||||||
|
s.sync = periodicsync.NewPeriodicSync(updatePeriodSec, 0, func(ctx context.Context) (err error) {
|
||||||
err = s.updateConfiguration(ctx)
|
err = s.updateConfiguration(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == ErrConfigurationNotChanged {
|
if err == ErrConfigurationNotChanged {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user