mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-16 21:56:40 -05:00
core: Load config at interval instead of just once
This commit is contained in:
parent
b47af6ef04
commit
7f364c777a
1 changed files with 12 additions and 9 deletions
3
caddy.go
3
caddy.go
|
@ -493,6 +493,7 @@ func finishSettingUp(ctx Context, cfg *Config) error {
|
||||||
}
|
}
|
||||||
if cfg.Admin.Config.LoadInterval > 0 {
|
if cfg.Admin.Config.LoadInterval > 0 {
|
||||||
go func() {
|
go func() {
|
||||||
|
for {
|
||||||
select {
|
select {
|
||||||
// if LoadInterval is positive, will wait for the interval and then run with new config
|
// if LoadInterval is positive, will wait for the interval and then run with new config
|
||||||
case <-time.After(time.Duration(cfg.Admin.Config.LoadInterval)):
|
case <-time.After(time.Duration(cfg.Admin.Config.LoadInterval)):
|
||||||
|
@ -503,8 +504,10 @@ func finishSettingUp(ctx Context, cfg *Config) error {
|
||||||
}
|
}
|
||||||
runLoadedConfig(loadedConfig)
|
runLoadedConfig(loadedConfig)
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
Log().Info("stopping config load interval")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
} else {
|
} else {
|
||||||
// if no LoadInterval is provided, will load config synchronously
|
// if no LoadInterval is provided, will load config synchronously
|
||||||
|
|
Loading…
Reference in a new issue