mirror of
https://github.com/netbirdio/netbird.git
synced 2025-06-19 08:17:01 +02:00
[client] Fix UI new version notifier (#3845)
This commit is contained in:
parent
207fa059d2
commit
1d4cfb83e7
@ -62,6 +62,8 @@ func main() {
|
||||
return
|
||||
}
|
||||
logFile = file
|
||||
} else {
|
||||
_ = util.InitLog("trace", "console")
|
||||
}
|
||||
|
||||
// Create the Fyne application.
|
||||
|
@ -93,23 +93,25 @@ func (u *Update) SetOnUpdateListener(updateFn func()) {
|
||||
}
|
||||
|
||||
func (u *Update) startFetcher() {
|
||||
changed := u.fetchVersion()
|
||||
if changed {
|
||||
if changed := u.fetchVersion(); changed {
|
||||
u.checkUpdate()
|
||||
}
|
||||
|
||||
select {
|
||||
case <-u.fetchDone:
|
||||
return
|
||||
case <-u.fetchTicker.C:
|
||||
changed := u.fetchVersion()
|
||||
if changed {
|
||||
u.checkUpdate()
|
||||
for {
|
||||
select {
|
||||
case <-u.fetchDone:
|
||||
return
|
||||
case <-u.fetchTicker.C:
|
||||
if changed := u.fetchVersion(); changed {
|
||||
u.checkUpdate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (u *Update) fetchVersion() bool {
|
||||
log.Debugf("fetching version info from %s", versionURL)
|
||||
|
||||
resp, err := http.Get(versionURL)
|
||||
if err != nil {
|
||||
log.Errorf("failed to fetch version info: %s", err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user