mirror of
https://github.com/coder/coder.git
synced 2026-09-22 13:10:21 +08:00
fix: Run status callbacks async to solve tailnet race (#3866)
This commit is contained in:
+7
-5
@@ -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)
|
||||
}()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user