mirror of
https://github.com/taigrr/go-selfupdate
synced 2025-01-18 04:33:12 -08:00
add ForceCheck parameter
This commit is contained in:
parent
8d409ca53a
commit
2212001dd7
@ -81,6 +81,7 @@ type Updater struct {
|
|||||||
BinURL string // Base URL for full binary downloads.
|
BinURL string // Base URL for full binary downloads.
|
||||||
DiffURL string // Base URL for diff downloads.
|
DiffURL string // Base URL for diff downloads.
|
||||||
Dir string // Directory to store selfupdate state.
|
Dir string // Directory to store selfupdate state.
|
||||||
|
ForceCheck bool // Check for update regardless of cktime timestamp
|
||||||
Requester Requester //Optional parameter to override existing http request handler
|
Requester Requester //Optional parameter to override existing http request handler
|
||||||
Info struct {
|
Info struct {
|
||||||
Version string
|
Version string
|
||||||
@ -117,7 +118,7 @@ func (u *Updater) BackgroundRun() error {
|
|||||||
|
|
||||||
func (u *Updater) wantUpdate() bool {
|
func (u *Updater) wantUpdate() bool {
|
||||||
path := u.getExecRelativeDir(u.Dir + upcktimePath)
|
path := u.getExecRelativeDir(u.Dir + upcktimePath)
|
||||||
if u.CurrentVersion == "dev" || readTime(path).After(time.Now()) {
|
if u.CurrentVersion == "dev" || (!u.ForceCheck && readTime(path).After(time.Now())) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
wait := 24*time.Hour + randDuration(24*time.Hour)
|
wait := 24*time.Hour + randDuration(24*time.Hour)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user