mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(tailnet): data race in coordinator.Close() (#4589)
This commit is contained in:
@@ -338,10 +338,10 @@ func (c *coordinator) handleNextAgentMessage(id uuid.UUID, decoder *json.Decoder
|
||||
func (c *coordinator) Close() error {
|
||||
c.mutex.Lock()
|
||||
if c.closed {
|
||||
c.mutex.Unlock()
|
||||
return nil
|
||||
}
|
||||
c.closed = true
|
||||
c.mutex.Unlock()
|
||||
|
||||
wg := sync.WaitGroup{}
|
||||
|
||||
@@ -365,6 +365,8 @@ func (c *coordinator) Close() error {
|
||||
}
|
||||
}
|
||||
|
||||
c.mutex.Unlock()
|
||||
|
||||
wg.Wait()
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user