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) - 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) - 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) - 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) ## 0.15.0 (2022-03-20)

View file

@ -103,11 +103,11 @@ disable_check_updates: false
# Time before an inactive ephemeral node is deleted? # Time before an inactive ephemeral node is deleted?
ephemeral_node_inactivity_timeout: 30m 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 # 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. # In case of doubts, do not touch the default 10s.
changes_check_interval: 10s node_update_check_interval: 10s
# SQLite config # SQLite config
db_type: sqlite3 db_type: sqlite3

View file

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

View file

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