Skip to content

Commit e008887

Browse files
committed
Resolve comments
1 parent 73e7e73 commit e008887

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

client/internal/updatemanager/manager.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,20 @@ func (u *UpdateManager) SetVersion(v string) {
6161
log.Tracef("Auto-update version set to %s", v)
6262
u.version = v
6363
u.mutex.Unlock()
64-
go u.Updated("N/A")
64+
go u.Updated(unknownVersion)
6565
} else {
6666
u.mutex.Unlock()
6767
}
6868
}
6969

7070
func (u *UpdateManager) Stop() {
71-
u.update.StopWatch()
7271
u.cancel()
72+
u.mutex.Lock()
73+
defer u.mutex.Unlock()
74+
if u.update != nil {
75+
u.update.StopWatch()
76+
u.update = nil
77+
}
7378
u.waitGroup.Wait()
7479
}
7580

@@ -78,12 +83,7 @@ func (u *UpdateManager) Updated(latestVersion string) {
7883
defer u.waitGroup.Done()
7984
u.mutex.Lock()
8085
defer u.mutex.Unlock()
81-
select {
82-
case <-u.ctx.Done():
83-
return
84-
default:
85-
}
86-
if latestVersion != "N/A" {
86+
if latestVersion != unknownVersion {
8787
u.latestVersion = latestVersion
8888
}
8989
ctx, cancel := context.WithDeadline(u.ctx, time.Now().Add(time.Minute))

0 commit comments

Comments
 (0)