fix update check logic

pull/14997/head
Steven Powell 2022-09-21 16:06:21 -07:00
parent 1d80003313
commit 1ba9792419
2 changed files with 8 additions and 5 deletions

View File

@ -148,11 +148,8 @@ func runStart(cmd *cobra.Command, args []string) {
displayVersion(version.GetVersion())
go download.CleanUpOlderPreloads()
// No need to do the update check if no one is going to see it
if !viper.GetBool(interactive) || !viper.GetBool(dryRun) {
// Avoid blocking execution on optional HTTP fetches
go notify.MaybePrintUpdateTextFromGithub()
}
// Avoid blocking execution on optional HTTP fetches
go notify.MaybePrintUpdateTextFromGithub()
displayEnviron(os.Environ())
if viper.GetBool(force) {

View File

@ -119,6 +119,12 @@ func shouldCheckURLVersion(filePath string) bool {
if !viper.GetBool(config.WantUpdateNotification) {
return false
}
if !viper.GetBool("interactive") {
return false
}
if viper.GetBool("dry-run") {
return false
}
lastUpdateTime := timeFromFileIfExists(filePath)
return time.Since(lastUpdateTime).Hours() >= viper.GetFloat64(config.ReminderWaitPeriodInHours)
}