Skip to content

Commit

Permalink
Merge pull request #252 from cloudradar-monitoring/fix-system-updates…
Browse files Browse the repository at this point in the history
…-intervals-typecasting

Fix system_updates_checks interval fields type usage
  • Loading branch information
nikita-vanyasin authored May 21, 2020
2 parents 32432b6 + 5ae2ce6 commit 63aea12
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}
}
}
6 changes: 3 additions & 3 deletions pkg/monitoring/updates/updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}),
}
Expand Down

0 comments on commit 63aea12

Please sign in to comment.