mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
swarm/storage/localstore: more correct testDB_collectGarbageWorker
This commit is contained in:
parent
f25b2e026e
commit
e65a7e4ac6
2 changed files with 1 additions and 10 deletions
|
|
@ -134,7 +134,7 @@ func (db *DB) collectGarbageWorker() {
|
|||
db.triggerGarbageCollection()
|
||||
}
|
||||
|
||||
if testHookCollectGarbage != nil {
|
||||
if collectedCount > 0 && testHookCollectGarbage != nil {
|
||||
testHookCollectGarbage(collectedCount)
|
||||
}
|
||||
case <-db.close:
|
||||
|
|
|
|||
|
|
@ -118,15 +118,6 @@ func testDB_collectGarbageWorker(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
})
|
||||
|
||||
// cleanup: drain the last testHookCollectGarbageChan
|
||||
// element before calling deferred functions not to block
|
||||
// collectGarbageWorker loop, preventing the race in
|
||||
// setting testHookCollectGarbage function
|
||||
select {
|
||||
case <-testHookCollectGarbageChan:
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
// TestDB_collectGarbageWorker_withRequests is a helper test function
|
||||
|
|
|
|||
Loading…
Reference in a new issue