Fix race condition in `LDBDatabase.Close()`
- https://jenkins.status.im/job/status-go/job/race-check/54/consoleFull
This commit is contained in:
parent
04fa765daf
commit
acbf251a3c
|
@ -35,9 +35,20 @@ index 001d8f0bb..4c9b1412c 100644
|
|||
- go db.meter(3 * time.Second)
|
||||
+ db.wg.Add(1)
|
||||
+ go func() {
|
||||
+ db.wg.Done()
|
||||
+ defer db.wg.Done()
|
||||
+ db.meter(3 * time.Second)
|
||||
+ }()
|
||||
}
|
||||
|
||||
// meter periodically retrieves internal leveldb counters and reports them to
|
||||
@@ -345,9 +347,8 @@ func (db *LDBDatabase) meter(refresh tim
|
||||
|
||||
// Sleep a bit, then repeat the stats collection
|
||||
select {
|
||||
- case errc := <-db.quitChan:
|
||||
+ case <-db.quitChan:
|
||||
// Quit requesting, stop hammering the database
|
||||
- errc <- nil
|
||||
return
|
||||
|
||||
case <-time.After(refresh):
|
||||
|
|
|
@ -173,7 +173,7 @@ func (db *LDBDatabase) Meter(prefix string) {
|
|||
|
||||
db.wg.Add(1)
|
||||
go func() {
|
||||
db.wg.Done()
|
||||
defer db.wg.Done()
|
||||
db.meter(3 * time.Second)
|
||||
}()
|
||||
}
|
||||
|
@ -347,9 +347,8 @@ func (db *LDBDatabase) meter(refresh time.Duration) {
|
|||
|
||||
// Sleep a bit, then repeat the stats collection
|
||||
select {
|
||||
case errc := <-db.quitChan:
|
||||
case <-db.quitChan:
|
||||
// Quit requesting, stop hammering the database
|
||||
errc <- nil
|
||||
return
|
||||
|
||||
case <-time.After(refresh):
|
||||
|
|
Loading…
Reference in New Issue