[client] Fix UI new version notifier (#3845)

This commit is contained in:
Viktor Liu 2025-05-20 10:39:17 +02:00 committed by GitHub
parent 207fa059d2
commit 1d4cfb83e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 9 deletions

View File

@ -62,6 +62,8 @@ func main() {
return
}
logFile = file
} else {
_ = util.InitLog("trace", "console")
}
// Create the Fyne application.

View File

@ -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)