Renamed config param for node update check internal

This commit is contained in:
Juan Font Alonso 2022-07-12 12:52:03 +02:00
parent 8e0939f403
commit 5b5298b025
4 changed files with 14 additions and 14 deletions

View File

@ -33,7 +33,7 @@
- Fix nodes being shown as 'offline' in `tailscale status` [#648](https://github.com/juanfont/headscale/pull/648)
- Improve shutdown behaviour [#651](https://github.com/juanfont/headscale/pull/651)
- Drop Gin as web framework in Headscale [648](https://github.com/juanfont/headscale/pull/648)
- Make tailnet updates check interval configurable [#675](https://github.com/juanfont/headscale/pull/675)
- Make tailnet node updates check interval configurable [#675](https://github.com/juanfont/headscale/pull/675)
## 0.15.0 (2022-03-20)

View File

@ -103,11 +103,11 @@ disable_check_updates: false
# Time before an inactive ephemeral node is deleted?
ephemeral_node_inactivity_timeout: 30m
# Period to check for changes in the tailnet. A value too low will severily affect
# Period to check for node updates in the tailnet. A value too low will severily affect
# CPU consumption of Headscale. A value too high (over 60s) will cause problems
# to the nodes, as they won't get updates or keep alive messages on time.
# to the nodes, as they won't get updates or keep alive messages in time.
# In case of doubts, do not touch the default 10s.
changes_check_interval: 10s
node_update_check_interval: 10s
# SQLite config
db_type: sqlite3

View File

@ -26,7 +26,7 @@ type Config struct {
GRPCAddr string
GRPCAllowInsecure bool
EphemeralNodeInactivityTimeout time.Duration
ChangesCheckInterval time.Duration
NodeUpdateCheckInterval time.Duration
IPPrefixes []netaddr.IPPrefix
PrivateKeyPath string
BaseDomain string
@ -163,7 +163,7 @@ func LoadConfig(path string, isFile bool) error {
viper.SetDefault("ephemeral_node_inactivity_timeout", "120s")
viper.SetDefault("changes_check_interval", "10s")
viper.SetDefault("node_update_check_interval", "10s")
if err := viper.ReadInConfig(); err != nil {
log.Warn().Err(err).Msg("Failed to read configuration from disk")
@ -220,12 +220,12 @@ func LoadConfig(path string, isFile bool) error {
)
}
maxChangesCheckInterval, _ := time.ParseDuration("60s")
if viper.GetDuration("changes_check_interval") > maxChangesCheckInterval {
maxNodeUpdateCheckInterval, _ := time.ParseDuration("60s")
if viper.GetDuration("node_update_check_interval") > maxNodeUpdateCheckInterval {
errorText += fmt.Sprintf(
"Fatal config error: changes_check_interval (%s) is set too high, must be less than %s",
viper.GetString("changes_check_interval"),
maxChangesCheckInterval,
"Fatal config error: node_update_check_interval (%s) is set too high, must be less than %s",
viper.GetString("node_update_check_interval"),
maxNodeUpdateCheckInterval,
)
}
@ -490,8 +490,8 @@ func GetHeadscaleConfig() (*Config, error) {
"ephemeral_node_inactivity_timeout",
),
ChangesCheckInterval: viper.GetDuration(
"changes_check_interval",
NodeUpdateCheckInterval: viper.GetDuration(
"node_update_check_interval",
),
DBtype: viper.GetString("db_type"),

View File

@ -639,7 +639,7 @@ func (h *Headscale) scheduledPollWorker(
machine *Machine,
) {
keepAliveTicker := time.NewTicker(keepAliveInterval)
updateCheckerTicker := time.NewTicker(h.cfg.ChangesCheckInterval)
updateCheckerTicker := time.NewTicker(h.cfg.NodeUpdateCheckInterval)
defer closeChanWithLog(
updateChan,