Skip to content

Commit

Permalink
Only check for updates once per day
Browse files Browse the repository at this point in the history
  • Loading branch information
ipmb committed Mar 25, 2023
1 parent 0b4e844 commit 0d829d5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ type StateEntry struct {

// CheckForUpdate checks whether this software has had a newer release on GitHub
func CheckForUpdate(ctx context.Context, client *http.Client, stateFilePath, repo, currentVersion string) (*ReleaseInfo, error) {
// stateEntry, _ := getStateEntry(stateFilePath)
// if stateEntry != nil && time.Since(stateEntry.CheckedForUpdateAt).Hours() < 24 {
// return nil, nil
// }
stateEntry, _ := getStateEntry(stateFilePath)
if stateEntry != nil && time.Since(stateEntry.CheckedForUpdateAt).Hours() < 24 {
return nil, nil
}

releaseInfo, err := getLatestReleaseInfo(ctx, client, repo)
if err != nil {
Expand Down

0 comments on commit 0d829d5

Please sign in to comment.