You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ha...@apache.org on 2022/08/24 23:30:06 UTC

[skywalking-banyandb] branch main updated: Fix data race (#158)

This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git


The following commit(s) were added to refs/heads/main by this push:
     new bb433f4  Fix data race (#158)
bb433f4 is described below

commit bb433f4f69d3529908ddeb99f5de73bad02209bb
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Thu Aug 25 07:30:01 2022 +0800

    Fix data race (#158)
---
 banyand/tsdb/block.go | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/banyand/tsdb/block.go b/banyand/tsdb/block.go
index cb5dd65..a090f41 100644
--- a/banyand/tsdb/block.go
+++ b/banyand/tsdb/block.go
@@ -164,13 +164,14 @@ func (b *block) open() (err error) {
 	}
 	b.closableLst = append(b.closableLst, b.invertedIndex, b.lsmIndex)
 	b.ref.Store(0)
-	b.stopCh = make(chan struct{})
+	stopCh := make(chan struct{})
+	b.stopCh = stopCh
 	go func() {
 		for {
 			select {
 			case <-b.flushCh:
 				b.flush()
-			case <-b.stopCh:
+			case <-stopCh:
 				return
 			}
 		}