fix WARNING: DATA RACE issue when multiple goroutines access the backend concurrently

This commit is contained in:
ahrtr
2022-04-03 06:01:10 +08:00
parent 3d3c4373e3
commit 836bd6bc3a
4 changed files with 17 additions and 3 deletions

View File

@ -419,6 +419,8 @@ func (b *backend) run() {
func (b *backend) Close() error {
close(b.stopc)
<-b.donec
b.mu.Lock()
defer b.mu.Unlock()
return b.db.Close()
}