mirror of https://github.com/grpc/grpc-go.git
internal/binarylog: Fix data race when calling Write() and Close() in parallel (#4604)
They both touched bufferedSink.writeTicker
This commit is contained in:
parent
ce7bdf50ab
commit
65cabd74d8
|
@ -133,12 +133,12 @@ func (fs *bufferedSink) startFlushGoroutine() {
|
|||
}
|
||||
|
||||
func (fs *bufferedSink) Close() error {
|
||||
fs.mu.Lock()
|
||||
defer fs.mu.Unlock()
|
||||
if fs.writeTicker != nil {
|
||||
fs.writeTicker.Stop()
|
||||
}
|
||||
close(fs.done)
|
||||
fs.mu.Lock()
|
||||
defer fs.mu.Unlock()
|
||||
if err := fs.buf.Flush(); err != nil {
|
||||
grpclogLogger.Warningf("failed to flush to Sink: %v", err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue