Fix tsafe close deadlock (#8567)

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/8552/head
congqixia 2021-09-26 14:29:57 +08:00 committed by GitHub
parent 0483ae810f
commit de3fd15aee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -164,12 +164,13 @@ func (ts *tSafe) set(id UniqueID, t Timestamp) {
}
func (ts *tSafe) close() {
ts.tSafeMu.Lock()
defer ts.tSafeMu.Unlock()
ts.cancel()
// wait for all job done
ts.closeWg.Wait()
ts.tSafeMu.Lock()
defer ts.tSafeMu.Unlock()
for _, watcher := range ts.watcherList {
close(watcher.notifyChan)
}