Avoid buffering the entire file list during walks

This commit is contained in:
Jakob Borg
2014-07-15 14:27:46 +02:00
parent 8b349945de
commit 32a5e83612
3 changed files with 62 additions and 24 deletions

View File

@@ -290,6 +290,7 @@ func main() {
rateBucket = ratelimit.NewBucketWithRate(float64(1000*cfg.Options.MaxSendKbps), int64(5*1000*cfg.Options.MaxSendKbps))
}
removeLegacyIndexes()
db, err := leveldb.OpenFile(filepath.Join(confDir, "index"), nil)
if err != nil {
l.Fatalln("leveldb.OpenFile():", err)
@@ -519,7 +520,12 @@ func resetRepositories() {
}
}
pat := filepath.Join(confDir, "*.idx.gz")
idx := filepath.Join(confDir, "index")
os.RemoveAll(idx)
}
func removeLegacyIndexes() {
pat := filepath.Join(confDir, "*.idx.gz*")
idxs, err := filepath.Glob(pat)
if err == nil {
for _, idx := range idxs {