From 5b5298b0255098a0653da985f3b412fc133cbb40 Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Tue, 12 Jul 2022 12:52:03 +0200 Subject: [PATCH] Renamed config param for node update check internal --- CHANGELOG.md | 2 +- config-example.yaml | 6 +++--- config.go | 18 +++++++++--------- poll.go | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23064ac1..1c63ae49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/config-example.yaml b/config-example.yaml index c32f9416..d3d155e2 100644 --- a/config-example.yaml +++ b/config-example.yaml @@ -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 diff --git a/config.go b/config.go index 0ef09110..6789f6f0 100644 --- a/config.go +++ b/config.go @@ -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"), diff --git a/poll.go b/poll.go index 95fb542c..6628a179 100644 --- a/poll.go +++ b/poll.go @@ -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,