storage/memorybysubnet: delete empty subnet buckets
This commit is contained in:
parent
cb6a3be2ac
commit
b013106f89
1 changed files with 6 additions and 0 deletions
|
@ -547,6 +547,9 @@ func (s *peerStore) collectGarbage(cutoff time.Time) error {
|
|||
delete(shard.swarms[ih].leechers[subnet], pk)
|
||||
}
|
||||
}
|
||||
if len(shard.swarms[ih].leechers[subnet]) == 0 {
|
||||
delete(shard.swarms[ih].leechers, subnet)
|
||||
}
|
||||
}
|
||||
|
||||
for subnet := range shard.swarms[ih].seeders {
|
||||
|
@ -555,6 +558,9 @@ func (s *peerStore) collectGarbage(cutoff time.Time) error {
|
|||
delete(shard.swarms[ih].seeders[subnet], pk)
|
||||
}
|
||||
}
|
||||
if len(shard.swarms[ih].seeders[subnet]) == 0 {
|
||||
delete(shard.swarms[ih].seeders, subnet)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(jzelinskie): fix this to sum all peers in all subnets
|
||||
|
|
Loading…
Add table
Reference in a new issue