provider: Kiro's identity refresh reads askKiroIdentity before its goroutine starts, not inside it
The goroutine read the package variable while a test put its own back, a data race go test -race reported in the provider package. The value is taken under the same lock that sets s.refreshing. go test -race ./internal/provider passes twice and -count=10 on the Kiro/Qoder tests.
This commit is contained in:
1 parent
bfe8bcafb8
commit
ccdd18e3f0
1 file changed
+2
-1
@@ -832,8 +832,9 @@ func kiroIdentity(key, home string) (user, plan string) {
|
||||
}
|
||||
if time.Since(s.at) > 5*time.Minute && !s.refreshing {
|
||||
s.refreshing = true
|
||||
ask := askKiroIdentity // read here: a test puts its own back meanwhile
|
||||
go func() {
|
||||
u, p := askKiroIdentity(key, home)
|
||||
u, p := ask(key, home)
|
||||
kiroStatus.Lock()
|
||||
if u != "" || p != "" {
|
||||
s.user, s.plan = u, p
|
||||
|
||||
Reference in new issue
Block a user