Skip to content

Commit

Permalink
Automatically check for updates once every 28 hours
Browse files Browse the repository at this point in the history
This reduces the amount of time between checks in order to encourage
users to update often.
  • Loading branch information
Zachary Scott authored and marcomorain committed Nov 14, 2018
1 parent 709ad2b commit 75a319e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions update/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ import (
"github.com/rhysd/go-github-selfupdate/selfupdate"
)

var hoursPerWeek = 168
// hoursBeforeCheck is used to configure the delay between auto-update checks
var hoursBeforeCheck = 28

// ShouldCheckForUpdates tell us if the last update check was more than a week ago
// ShouldCheckForUpdates tell us if the last update check was more than a day ago
func ShouldCheckForUpdates(upd *settings.UpdateCheck) bool {
diff := time.Since(upd.LastUpdateCheck)
return diff.Hours() >= float64(hoursPerWeek)
return diff.Hours() >= float64(hoursBeforeCheck)
}

// CheckForUpdates will check for updates given the proper package manager
Expand Down

0 comments on commit 75a319e

Please sign in to comment.