mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
swarm/storage: Remove comment
This commit is contained in:
parent
82ca35d666
commit
47db1fa245
2 changed files with 8 additions and 26 deletions
|
|
@ -101,7 +101,7 @@ type garbage struct {
|
|||
count int // number of chunks deleted in running round
|
||||
target int // number of chunks to delete in running round
|
||||
batch *dbBatch // the delete batch
|
||||
runC chan struct{}
|
||||
runC chan struct{} // struct in chan means gc is NOT running
|
||||
}
|
||||
|
||||
type LDBStore struct {
|
||||
|
|
@ -187,6 +187,7 @@ func NewLDBStore(params *LDBStoreParams) (s *LDBStore, err error) {
|
|||
maxRound: defaultMaxGCRound,
|
||||
ratio: defaultGCRatio,
|
||||
}
|
||||
|
||||
s.gc.runC = make(chan struct{}, 1)
|
||||
s.gc.runC <- struct{}{}
|
||||
|
||||
|
|
@ -313,7 +314,6 @@ func decodeData(addr Address, data []byte) (*chunk, error) {
|
|||
func (s *LDBStore) collectGarbage() error {
|
||||
|
||||
// prevent duplicate gc from starting when one is already running
|
||||
// runC contains a struct{} as long as we are NOT running
|
||||
if len(s.gc.runC) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -589,21 +589,3 @@ func waitGc(ctx context.Context, ldb *LDBStore) {
|
|||
<-ldb.gc.runC
|
||||
ldb.gc.runC <- struct{}{}
|
||||
}
|
||||
|
||||
//func waitGc(ctx context.Context, ldb *LDBStore) error {
|
||||
// ticker := time.Tick(time.Millisecond * 100)
|
||||
// for {
|
||||
// select {
|
||||
//
|
||||
// case <-ctx.Done():
|
||||
// return errors.New("timeout")
|
||||
// case <-ticker:
|
||||
// ldb.lock.Lock()
|
||||
// running := ldb.gc.running
|
||||
// ldb.lock.Unlock()
|
||||
// if !running {
|
||||
// return nil
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
|
|||
Loading…
Reference in a new issue