mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(enterprise/replicasync): Avoid deadlock during Close (#7220)
This commit is contained in:
@@ -216,6 +216,12 @@ func (m *Manager) subscribe(ctx context.Context) error {
|
||||
|
||||
func (m *Manager) syncReplicas(ctx context.Context) error {
|
||||
m.closeMutex.Lock()
|
||||
select {
|
||||
case <-m.closed:
|
||||
m.closeMutex.Unlock()
|
||||
return xerrors.New("manager is closed")
|
||||
default:
|
||||
}
|
||||
m.closeWait.Add(1)
|
||||
m.closeMutex.Unlock()
|
||||
defer m.closeWait.Done()
|
||||
|
||||
Reference in New Issue
Block a user