mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
swarm/storage/localstore: add triggerGarbageCollection function
This commit is contained in:
parent
cee4004dff
commit
b5a0fd285f
1 changed files with 11 additions and 8 deletions
|
|
@ -55,10 +55,7 @@ func (db *DB) collectGarbageWorker() {
|
|||
}
|
||||
// check if another gc run is needed
|
||||
if !done {
|
||||
select {
|
||||
case db.collectGarbageTrigger <- struct{}{}:
|
||||
default:
|
||||
}
|
||||
db.triggerGarbageCollection()
|
||||
}
|
||||
|
||||
if testHookCollectGarbage != nil {
|
||||
|
|
@ -131,10 +128,16 @@ func (db *DB) incGCSize(count int64) {
|
|||
default:
|
||||
}
|
||||
if new >= db.capacity {
|
||||
select {
|
||||
case db.collectGarbageTrigger <- struct{}{}:
|
||||
default:
|
||||
}
|
||||
db.triggerGarbageCollection()
|
||||
}
|
||||
}
|
||||
|
||||
// triggerGarbageCollection signals collectGarbageWorker
|
||||
// to call collectGarbage.
|
||||
func (db *DB) triggerGarbageCollection() {
|
||||
select {
|
||||
case db.collectGarbageTrigger <- struct{}{}:
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue