mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
swarm/storage: user read locks in TestLDBStoreCollectGarbage
This commit is contained in:
parent
be56353a0e
commit
dde6b11e42
1 changed files with 4 additions and 4 deletions
|
|
@ -388,9 +388,9 @@ func testLDBStoreCollectGarbage(t *testing.T) {
|
||||||
t.Fatal(err.Error())
|
t.Fatal(err.Error())
|
||||||
}
|
}
|
||||||
allChunks = append(allChunks, chunks...)
|
allChunks = append(allChunks, chunks...)
|
||||||
ldb.lock.Lock()
|
ldb.lock.RLock()
|
||||||
log.Debug("ldbstore", "entrycnt", ldb.entryCnt, "accesscnt", ldb.accessCnt, "cap", capacity, "n", n)
|
log.Debug("ldbstore", "entrycnt", ldb.entryCnt, "accesscnt", ldb.accessCnt, "cap", capacity, "n", n)
|
||||||
ldb.lock.Unlock()
|
ldb.lock.RUnlock()
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
@ -539,9 +539,9 @@ func testLDBStoreRemoveThenCollectGarbage(t *testing.T) {
|
||||||
remaining -= putCount
|
remaining -= putCount
|
||||||
for putCount > 0 {
|
for putCount > 0 {
|
||||||
ldb.Put(context.TODO(), chunks[puts])
|
ldb.Put(context.TODO(), chunks[puts])
|
||||||
ldb.lock.Lock()
|
ldb.lock.RLock()
|
||||||
log.Debug("ldbstore", "entrycnt", ldb.entryCnt, "accesscnt", ldb.accessCnt, "cap", capacity, "n", n, "puts", puts, "remaining", remaining, "roundtarget", roundTarget)
|
log.Debug("ldbstore", "entrycnt", ldb.entryCnt, "accesscnt", ldb.accessCnt, "cap", capacity, "n", n, "puts", puts, "remaining", remaining, "roundtarget", roundTarget)
|
||||||
ldb.lock.Unlock()
|
ldb.lock.RUnlock()
|
||||||
puts++
|
puts++
|
||||||
putCount--
|
putCount--
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue