mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-22 07:57:34 +00:00
Renamed config param for node update check internal
This commit is contained in:
parent
8e0939f403
commit
5b5298b025
@ -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)
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
18
config.go
18
config.go
@ -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"),
|
||||||
|
2
poll.go
2
poll.go
@ -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,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user