Commit d7b16a50 authored by Addshore's avatar Addshore 🏄
Browse files

Check for updates every 3h not 24

parent 51fe7892
...@@ -6,7 +6,7 @@ Each tagged release MUST have a section 2 heading starting at the time of releas ...@@ -6,7 +6,7 @@ Each tagged release MUST have a section 2 heading starting at the time of releas
## Unreleased ## Unreleased
- ... - Changed update check period from 1 day to 3 hours.
## v0.2.1 ## v0.2.1
......
...@@ -29,9 +29,9 @@ import ( ...@@ -29,9 +29,9 @@ import (
/*CanUpdateDaily will check for updates at most once a day*/ /*CanUpdateDaily will check for updates at most once a day*/
func CanUpdateDaily(currentVersion string, gitSummary string, verboseOutput bool) (bool, string) { func CanUpdateDaily(currentVersion string, gitSummary string, verboseOutput bool) (bool, string) {
now := time.Now().UTC() now := time.Now().UTC()
if now.Sub(lastCheckedTime()).Hours() < 24 { if now.Sub(lastCheckedTime()).Hours() < 3 {
if verboseOutput { if verboseOutput {
log.Println("Already checked for updates in the last 24 hours") log.Println("Already checked for updates in the last 3 hours")
} }
return false, "" return false, ""
} }
...@@ -42,7 +42,7 @@ func CanUpdateDaily(currentVersion string, gitSummary string, verboseOutput bool ...@@ -42,7 +42,7 @@ func CanUpdateDaily(currentVersion string, gitSummary string, verboseOutput bool
func lastCheckedTime() time.Time { func lastCheckedTime() time.Time {
if _, err := os.Stat(lastUpdateFilePath()); os.IsNotExist(err) { if _, err := os.Stat(lastUpdateFilePath()); os.IsNotExist(err) {
return time.Now().UTC().Add(-24 * time.Hour * 7) return time.Now().UTC().Add(-3 * time.Hour * 7)
} }
content, err := ioutil.ReadFile(lastUpdateFilePath()) content, err := ioutil.ReadFile(lastUpdateFilePath())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment