fix: accesslog writer cache close cause deadlock (#33261)

relate: https://github.com/milvus-io/milvus/issues/33260

Signed-off-by: aoiasd <zhicheng.yue@zilliz.com>
pull/33270/head
aoiasd 2024-05-22 14:55:39 +08:00 committed by GitHub
parent de7901121f
commit 13fdaea9f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 3 deletions

View File

@ -113,12 +113,15 @@ func (l *CacheWriter) Start() {
}
func (l *CacheWriter) Close() {
l.mu.Lock()
defer l.mu.Unlock()
l.closeOnce.Do(func() {
l.closed = true
// close auto flush
close(l.closeCh)
l.closeWg.Wait()
l.mu.Lock()
defer l.mu.Unlock()
l.closed = true
// flush remaining bytes
l.writer.Flush()