fix(enterprise/replicasync): Avoid deadlock during Close (#7220)

This commit is contained in:
Mathias Fredriksson
2023-04-20 15:37:30 +03:00
committed by GitHub
parent 528a0686c0
commit 8d27978760
+6
View File
@@ -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()