加在文件Hash时加入防无限循环机制

This commit is contained in:
刘祥超
2023-10-05 23:08:40 +08:00
parent 2af577380e
commit b73f0ae2c9

View File

@@ -51,6 +51,7 @@ func (this *FileListHashMap) Load(db *FileListDB) error {
this.isAvailable = true
var lastId int64
var maxLoops = 50_000
for {
hashList, maxId, err := db.ListHashes(lastId)
if err != nil {
@@ -61,6 +62,11 @@ func (this *FileListHashMap) Load(db *FileListDB) error {
}
this.AddHashes(hashList)
lastId = maxId
maxLoops --
if maxLoops <= 0 {
break
}
}
this.isReady = true