added version cache
This commit is contained in:
parent
1bb183c2aa
commit
3c53a2162c
@ -3,6 +3,7 @@ package update
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Updater struct {
|
type Updater struct {
|
||||||
@ -10,6 +11,10 @@ type Updater struct {
|
|||||||
|
|
||||||
currentBinary string // current binary executable
|
currentBinary string // current binary executable
|
||||||
workDir string // updater work dir (where backup/upd dirs will be created)
|
workDir string // updater work dir (where backup/upd dirs will be created)
|
||||||
|
|
||||||
|
// cached version.json to avoid hammering github.io for each page reload
|
||||||
|
versionCheckJSON []byte
|
||||||
|
versionCheckLastTime time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewUpdater - creates a new instance of the Updater
|
// NewUpdater - creates a new instance of the Updater
|
||||||
@ -17,6 +22,8 @@ func NewUpdater(workDir string) *Updater {
|
|||||||
return &Updater{
|
return &Updater{
|
||||||
currentBinary: filepath.Base(os.Args[0]),
|
currentBinary: filepath.Base(os.Args[0]),
|
||||||
workDir: workDir,
|
workDir: workDir,
|
||||||
|
versionCheckJSON: nil,
|
||||||
|
versionCheckLastTime: time.Time{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user