mirror of https://github.com/coder/coder.git
fix: Run status callbacks async to solve tailnet race (#3866)
This commit is contained in:
parent
3ca6f1fcd4
commit
2fa77a9bbd
|
@ -276,11 +276,13 @@ func (c *Conn) SetNodeCallback(callback func(node *Node)) {
|
|||
for _, addr := range s.LocalAddrs {
|
||||
endpoints = append(endpoints, addr.Addr.String())
|
||||
}
|
||||
c.lastMutex.Lock()
|
||||
c.lastEndpoints = endpoints
|
||||
node := makeNode()
|
||||
c.lastMutex.Unlock()
|
||||
callback(node)
|
||||
go func() {
|
||||
c.lastMutex.Lock()
|
||||
c.lastEndpoints = endpoints
|
||||
node := makeNode()
|
||||
c.lastMutex.Unlock()
|
||||
callback(node)
|
||||
}()
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue