From 5ae2ce61bbce1c9e668a8ff0356513e9b0a038c3 Mon Sep 17 00:00:00 2001 From: Nikita Vanyasin Date: Wed, 20 May 2020 23:15:20 +0300 Subject: [PATCH] Fix system_updates_checks interval fields type usage --- config.go | 8 ++++---- pkg/monitoring/updates/updates.go | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config.go b/config.go index 295f5a7..3ae79e9 100644 --- a/config.go +++ b/config.go @@ -147,9 +147,9 @@ type StorCLIConfig struct { } type UpdatesMonitoringConfig struct { - Enabled bool `toml:"enabled" comment:"Set 'false' to disable checking available updates"` - FetchTimeout uint `toml:"fetch_timeout" comment:"Maximum time the package manager is allowed to spend fetching available updates, ignored on windows"` - CheckInterval uint `toml:"check_interval" comment:"Check for available updates every N seconds. Minimum is 300 seconds"` + Enabled bool `toml:"enabled" comment:"Set 'false' to disable checking available updates"` + FetchTimeout uint32 `toml:"fetch_timeout" comment:"Maximum time the package manager is allowed to spend fetching available updates, ignored on windows"` + CheckInterval uint32 `toml:"check_interval" comment:"Check for available updates every N seconds. Minimum is 300 seconds"` } func (l *UpdatesMonitoringConfig) Validate() error { @@ -570,7 +570,7 @@ func (cfg *Config) migrate(cfgDeprecated *ConfigDeprecated, metadata toml.MetaDa if cfgDeprecated.WindowsUpdatesWatcherInterval <= 0 { cfg.SystemUpdatesChecks.Enabled = false } else { - cfg.SystemUpdatesChecks.CheckInterval = uint(cfgDeprecated.WindowsUpdatesWatcherInterval) + cfg.SystemUpdatesChecks.CheckInterval = uint32(cfgDeprecated.WindowsUpdatesWatcherInterval) } } } diff --git a/pkg/monitoring/updates/updates.go b/pkg/monitoring/updates/updates.go index 2dc7b5c..1f6a18c 100644 --- a/pkg/monitoring/updates/updates.go +++ b/pkg/monitoring/updates/updates.go @@ -29,14 +29,14 @@ func Shutdown() { } } -func GetWatcher(fetchTimeout, checkInterval uint) *Watcher { +func GetWatcher(fetchTimeout, checkInterval uint32) *Watcher { if watcher != nil { return watcher } watcher = &Watcher{ - fetchTimeout: time.Duration(uint(time.Second) * fetchTimeout), - checkInterval: time.Duration(uint(time.Second) * checkInterval), + fetchTimeout: time.Duration(int64(time.Second) * int64(fetchTimeout)), + checkInterval: time.Duration(int64(time.Second) * int64(checkInterval)), lastFetchedInfo: nil, interruptChan: make(chan struct{}), }